[time-nuts] I want a good micro-controller

Brooke Clarke brooke at pacific.net
Thu Sep 4 21:17:29 UTC 2008


Hi Chuck:

The Harvard architecture used in the PIC has a number of advantages when 
compared to the more common Von Neumann architecture, speed being of them.
http://en.wikipedia.org/wiki/Harvard_architecture
http://en.wikipedia.org/wiki/Von_Neumann_architecture

A not uncommon problem with Von Neumann computers is reading data as an 
instruction (since they share the same memory space).

The HP Rocky Mountain Basic is really an operating system and language all in 
one.  I've been paid to write hundreds of programs in RMB, many of them near 
the line number limit of the language.  It has many features not found in 
modern languages.

That let me to look into metrics for software and I found a couple of Microsoft 
Books:

Writing Solid Code
http://www.amazon.com/gp/product/1556155514/sr=1-5/qid=1154816669/ref=sr_1_5/104-7728798-0707156?ie=UTF8&s=books

Code Complete
http://www.amazon.com/gp/product/0735619670/sr=1-1/qid=1154816669/ref=sr_1_1/104-7728798-0707156?ie=UTF8&s=books

One example of good programming style is that the span of a loop is small.  For 
example you should be able to print the program so that each module fits on a 
one side of a single sheet of paper.

Have Fun,

Brooke Clarke
http://www.prc68.com/P/Prod.html  Products I make and sell
http://www.prc68.com/Alpha.shtml  All my web pages listed based on html name
http://www.PRC68.com
http://www.precisionclock.com
http://www.prc68.com/I/WebCam2.shtml 24/7 Sky-Weather-Astronomy Web Cam

Chuck Harris wrote:
> wje wrote:
>> As the one who made the first comment about not liking the PIC, I'll 
>> give you my reasons. Yes, they are philosophical, even religious. I'm 
>> also distinguishing between microprocessors (this discussion) and other 
>> variants, such as DSPs, FPLDs, etc.
>>
>> First, I've used a very large number of different micros over the years 
>> for both 'real' work and my own purposes, starting with the Intel 8008 
>> before it was commercially released. I've used Intel, TI, Motorola, 
>> Zilog, MOS Tech processors of multiple families, and yes, even PICs, all 
>> with wildly varying architectures. These days, given modern development 
>> tools, the architecture of a general-purpose micro really isn't 
>> particularly relevant. It's functionality and support tools that are 
>> important.
> 
> I too have a list of micro's and mini's as rich as yours:  PDP8, Univac
> 11XX, IBM360, PDP-11, 680XX, 8008, 8080, 8085, 8088, 8086, 80186, 80286,
> 80386, ... DSP-32, 1802, Z80, 8051, 6502,..., and many, many PIC's.  And
> with the exception of the first 5, I have been paid to program them all.
> 
>> Without a doubt, PIC made it possible for many hobbyists to put together 
>> nice projects that they would not necessarily have been able to do 
>> otherwise. My deep-seated revulsion comes from one source, and it's not 
>> the architecture, the company, or the capabilities of the chips. It's 
>> Basic, the language. Until relatively recently, PIC and Basic were 
>> almost synonymous, at least for the masses.
> 
> Ah, well, that explains it!  Your knowledge of PIC's is incomplete.  The
> BASIC PIC, known as the STAMP, was a simple program running on a PIC that
> showed off somethings that you could do with a PIC.  It was not even a
> Microchip product.  Parallax took a compiler they wrote, and programmed
> it on an early PIC, sold millions of them as the STAMP.
> 
> For more information: http://www.parallax.com/tabid/295/Default.aspx
> 
> I have never programmed a PIC in anything other than assembler, or C.
> 
> The PIC architecture is a RISC machine.  Its memory is split into DATA
> and CODE sections.  The entire data section is treated as pages of registers.
> All of the I/O is treated as data locations in memory.  It is dirt simple,
> having less than 40 instructions.
> 
> It is easy to program a PIC in assembler, and using a cross-compiler, it is
> reasonably easy for a compiler to generate good PIC code.  I have found
> that CCS's C compiler generates PIC code that is as good, or better than
> a talented human programmer can write.
> 
>> I have both EE and CS degrees, and I work in both worlds. 
> 
> For me it is a BSEE and an MSEE.  I design hardware and software for
> embedded systems.  My MS was about 50/50 microwaves and computer architecture.
> 
> In my humble
>> (but completely accurate and stable) opinion, Basic is not a programming 
>> language. It's a tool of Satan designed to convince people that they are 
>> programmers when they really should stick to their janitorial duties. 
>> This is a subset of the general problem that everyone thinks they are 
>> programmers, and usually think their code is perfect. But, that's a rant 
>> for a different audience.
> 
> Well, if you feel that way about BASIC, then you must really hate assembler.
> You can write good, or bad code in any language.  BASIC is no exception.
> If you treat BASIC as what it was intended to be, it is just fine.  It
> is a step above a pocket calculator, and should be used as such.  In my
> opinion, no BASIC program should be written that is longer than 100 lines.
> 
>> So, for me, given that there are some very good C development tools for 
>> mainstream processors, and frequently they are free, I just don't use 
>> PICs. As I mentioned earlier, I currently like the Motorola (I mean, 
>> Freescale; these silly name changes are yet another rant) MC68HCxx line; 
>> there's a wide choice of features and they can be flashed easily without 
>> a complicated programmer. The 8-pin xx908QT4 is a buck and does a fine 
>> job for many purposes, and most importantly, you can get a nice C 
>> development environment for the line, which was originally from 
>> CodeWarrior, for free. It also supports the entire line, from 8-bit to 
>> 32-bit, and with builtin support for all of the various on-chip 
>> 'peripherals'.
> 
> That's cool, but do any of them make a 6 pin uC that has some 10 bit ADC's
> built in?  Oh, and can get to better than 1% timing accuracy over the full
> industrial temperature range without a crystal?  Oh, is it available for
> under a buck in small quantities?  No?  Darn!
> 
>> Even now, I don't think Microchip provides a compiler that supports the 
>> low-end chips, but I haven't checked lately.
> 
> Not a valid complaint.  CCS supports everything that Microchip makes, and
> their compiler costs around $100.. and it produces tight efficient code.
> Plus, their library has native functions to access every feature of
> the PIC.  And as an added bonus, the windows version runs nicely under
> wine, and there is a linux version available too!
> 
>> But, when you get right down to it, you really need to pick the proper 
>> solution for your problem. If there was something the PICs provided that 
>> I couldn't get elsewhere, I'd use them. Religion is fine, but getting 
>> the job done is more important.
> 
> As I said, show me a 6 pin mini SOIC that has a built in oscillator
> that is accurate to better than 1% over the industrial temperature
> range (and voltage), has a handful of 10 bit ADC's built in, and can
> have a software UART on every pin (but one), and can be easily programmed
> in C, and costs under a buck (for full industrial temperature range).
> 
>> BTW, for those that think you can't do anything with an 8-pin 8-bit 
>> micro, I did one design that supports an LCD, a rotary encoder, a 
>> Hall-effect sensor, and a button. At home, I use the same chip in every 
>> light switch in my house to implement a self-tuning capacitance sense 
>> switch. I even use a couple for a more time-nuts related tasks. One 
>> provides loop control for my GPS/Rb/Quartz standard, and one is used as 
>> a 555 timer replacement in my SmartClock->PC interface. (Ok, I was in a 
>> hurry, needed a pulse stretcher, and I didn't have any 555's lying around)
> 
> I don't use 555's anymore, PICS are available that do the job better, and faster,
> and with lower power consumption.  And they are more stable frequency wise.
> 
> -Chuck Harris
> 
> 
> _______________________________________________
> time-nuts mailing list -- time-nuts at febo.com
> To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
> and follow the instructions there.
> 




More information about the Time-nuts_lists.febo.com mailing list