Choosing a microcontroller platform

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Choosing a microcontroller platform

Post by Newz2000 »

Years ago I was deeply interested in analog electronics. While in college I diverted my attention to computing platforms and now work programming computers and other tasks.<p>My brother and I are planning an ambitious project that will involve some robotic-like mechanics. While all or most of the parts we need can be purchased off the shelf, the costs will be quite high and will not do *exactly* what we want. It seems we can lower our costs, get precisely what we desire and have more fun doing it ourselves.<p>In the course of creating our own motor controller we have found the PIC 16F84, 16F628 and related processors. These are nice because the assembly language is very simple, the parts are cheap, and there is a wealth of example code and tools around.<p>I have been studying and experimenting with the PIC assembly language and found that, while it's probably the nicesest assembly I've seen, I wish I had access to a higher level language like C.<p>Additionally, I've found that one PIC processor will not do all we need, but instead will need 3 or 4. (2 stepper motors, 1 or 2 DC motors, several sensors and some actuators)<p>I'm fine doing that, but couldn't help wonder if there was a better way.<p>Flipping through the DIGI catalog, I saw an ad for the Zilog Z8 Encore development kit for < $40. It has the processor, the computer interface, a C compiler and 60 (60!?!) i/o lines.<p>It seems to me, that if an i/o line on this z80 kit is the same as an i/o port on a pic, one such development kit should do everything I need with the added bonus of having the necessary PC Interface and C compiler for an extremely reasonable price.<p>Can anyone confirm if this development kit sounds like what I need?
Can anyone make an alternate suggestion or provide some insight that I should consider?<p>Thanks for your tips,
Matt
rstofer
Posts: 115
Joined: Sun May 15, 2005 1:01 am
Contact:

Re: Choosing a microcontroller platform

Post by rstofer »

I don't think you will find the specialized hardare inside the Zilog Z8.<p>Let me offer another suggestion. Look at Atmel, particularly the ATmega128. Here you will have 128k of flash for program storage and 4k of SRAM for data. And it has ALL of the gadgets - in depth.<p>Take a look over at www.sparkfun.com - they have a ATmega128 Header Board that is all pins. Perfect for prototyping. Then take a look at the MAVRIC controllers at www.bdmicro.com. I just finished a MAVRIC kit and it is quite nice with the additional 128k of SRAM! Were I designing another 'bot, I would use the header board to prototype and then build a PCB.<p>Software: the chip is useless without it. Look into WinAVR. You will have the full GNU C/C++ compiler so the language is fully implemented and the WinAVR library contains code already written to drive all the gadgets. Multiple PWM, dual USARTs, 8 servos(standard), 8 A/D channels. It's all there! Oh, it's also FREE!<p>Programming of the header board: I am using the AVR In Circuit Emulator with USB Interface from Sparkfun because it allows me to debug from source level with AVR Studio 4 (free from Atmel). There is a collision with JTAG programming and the upper 4 A/D channels. If this is an issue, look at the STK500 programmer from Atmel. It uses ISP so there is no collision on the A/D. Pass on those programmers that require PonyProg - I don't think it supports the ATmega128.
rstofer
Posts: 115
Joined: Sun May 15, 2005 1:01 am
Contact:

Re: Choosing a microcontroller platform

Post by rstofer »

I forgot to mention: the ATmega128 is FAST. One short instruction per clock at 16 MHz or about 16 MIPS! More than 3 times the speed of the 16Fxx PICs. With instruction set differences, I wouldn't be surprised to find it 6 times as fast on a real program.
Gorgon
Posts: 325
Joined: Wed May 04, 2005 1:01 am
Location: Norway
Contact:

Re: Choosing a microcontroller platform

Post by Gorgon »

Hi Matt,
I've got the ‘Z8 Encore!’ development kit, but sorry to say I've not studied it too close. I bought it some time ago. I think it was a good offer and it struck a string of nostalgia with me. I did a lot of work on the Zilog controllers (Z80 Z8 and Super8) some 15-20 years ago, and I liked them very much. I still think that the features in the Super8 run circles around many of the smaller controllers of today.<p>I've just looked through the kit and found out that it used the Z8F6403 chip, and you are right, it has got 60 I/O. With all the different functional building blocks, a lot of the i/o is bound if you use these functions, but you still have a lot of free i/o. Please find out more in the datasheet: http://www.zilog.com/docs/z8encore/ps0176.pdf <p>I think you will find that it covers all of your requirements.<p>Good luck! ;) <p>TOK
Gorgon the Caretaker - Character in a childrens TV-show from 1968. ;)
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Re: Choosing a microcontroller platform

Post by Newz2000 »

That Maveric board looks very intriguing.<p>Am I correct when I say that both the ATmega128 header and the Maverick need to use a chip programmer with ICSP in order to program them?<p>Also, does the ATmega128 header plug into a breadboard? It's got an unusual layout and I don't see how it can connect.<p>Thanks for the pointers!
rstofer
Posts: 115
Joined: Sun May 15, 2005 1:01 am
Contact:

Re: Choosing a microcontroller platform

Post by rstofer »

First, I stand corrected, the Z8 does have a lot of internal gadgets.<p>Second, the ATmega: either way, you can program the boards with ISP or JTAG. I'm not sure of my facts here but it seems that if you buy the MAVRIC kit you may have to use JTAG to set the fuses to enable ISP. I read the chip documents and it says ISP is enabled as delivered but it didn't work for me. But that's just me, I could have done something wrong. The fuses are properly pre-programmed on the non-kit controller. The version with the terminal blocks is an interesting approach!<p>I haven't tried ISP on the header board - I use JTAG exclusively because I can use AVR Studio with the in-circuit debugger. I have no doubt that ISP works but you can't interactively debug with ISP.<p>As to ISP programming, there are a lot of programmers around that suggest they work with AVR Studio 4 and can program the ATmega128. Well, like with the PIC family, there are programmers and programmers that actually work. I skipped all the low end devices and went for the Atmel STK500 and I know for a fact it will program the MAVRIC with the ISP cable.<p>Personally, I think you need the flexibility of both programming schemes. If I had to choose, I would go with JTAG first and deal with the collision on the upper 4 A/D channels.<p>In-circuit debugging isn't all glory, you will find yourself getting trapped in interrupt handlers and such. But, it's better than nothing and you can avoid the handlers if you are careful. Maybe just debug code fragments before compiling the entire program.<p>The nice thing about WinAVR is the code is reasonable. If you use a USART, it will be interrupt driven with a user defined buffer, by default. It's nice to not have to reinvent the wheel and axle.<p>The header board doesn't really plug into a breadboard and I doubt there is a good way to mount it. If you chose to build one from the PCB only, you could put the headers on the top instead of the bottom. But, for prototyping, who cares? I just use plugs with an appropriate number of pins.<p>I bought the MAVRIC specifically to gain experience soldering surface mount components. I didn't necessarily expect success but it worked out quite well. It's a great controller! For soldering smd packages, see this:
http://www.howardelectronics.com/xytron ... %20107.wmv There will ALWAYS be some of this flux around my bench - NC-559-V2 flux - not the solder paste with the same number.
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: Choosing a microcontroller platform

Post by philba »

I wouldn't go down the zilog path - PIC and AVR lines both have a very wide range of parts that will fit your needs. Zilog stuff is ok but not nearly as broad.<p>AVR is much easier to program in assembly and there is a free C compiler (as noted). AVR is sometimes easy to screw up the programming so that ISP wont work. Faster than PIC. Software types really like the AVR - the architecutre makes a lot of sense.<p>PIC is far more ubiquitous but assembly language is a real pain due to a f*cked up architecture (ram pages, code banks, wierd skip instructions, far calls, ...). The 18F series is much better and disPIC is supposedly even better. There is a free C compiler which is somewhat crippled but still quite usable (cc5x/cc8 from bknudson). PICs are pretty resilient. I believe PICs are somewhat cheaper than AVRs. PICs have fantastic support (microchip appnotes, multiple forums, tons and tons of source code available, lots of schematics on the internet). <p>Bottom line is you can't go wrong with either of them.<p>Phil
ezpcb
Posts: 98
Joined: Tue Apr 19, 2005 1:01 am
Contact:

Re: Choosing a microcontroller platform

Post by ezpcb »

I had used all of the uCs you mentioned, I like PIC.<p>But I'm beginning to interested in Rensas H series, it has more choice than any of other mcu series. <p>mike
http://www.EzPCB.com
High Quality PCB for Electronics Hobbists, Pay for Chrokee, Get Land Rover
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: Choosing a microcontroller platform

Post by philba »

Yeah, I have to agree, the renesas (hitachi) stuff looks pretty good. There is some advantage to having 16 bits. Overall, their peripherals seem well thought out. Their timers are nicer than the PICs. I also like that a number of their processors have DMA - you dont see that very often. I was able to use the DMA channels for some pretty unique things. However, one big drawback is that on all but the really low end, they dont seem to source a lot of current on their output pins. PICs and AVRs are better there. <p>They've come a long way since the old SH-8 that sega was pushing.
ezpcb
Posts: 98
Joined: Tue Apr 19, 2005 1:01 am
Contact:

Re: Choosing a microcontroller platform

Post by ezpcb »

The current sink capability is so much easier to deal with than lack of DMA.
The biggest drawback is the development of H series is costly, tools and softwares are not easy to find as PIC or AVR.<p>mike
http://www.EzPCB.com
High Quality PCB for Electronics Hobbists, Pay for Chrokee, Get Land Rover
bodgy
Posts: 1044
Joined: Tue Dec 04, 2001 1:01 am
Location: Australia
Contact:

Re: Choosing a microcontroller platform

Post by bodgy »

There is a range in the 18F series that are designed for running motors etc.<p>If you are relatively new to Pics, then I'd suggest starting with the 18F series, these have some extra useful instructions as well as easier (in ASM) access to the whole of memory.<p>They are also optimised for the 'C' language.<p>Compilers that aren't too expensive that are worth checking are -<p>Basic18 (a structured basic, allows seamless ASM use within the basic statements)<p>FedC strong point is it's simulator<p>Various languages from Mikrokontroller.co.yu.<p>If staying with the 16F series, then the bigger boys such as the 16F877A or the newer 648A, 619 77 etc are better to go with.<p>Same compilers as above except for Basic18 replace with XCSB structured basic.<p>Colin
On a clear disk you can seek forever.
rstofer
Posts: 115
Joined: Sun May 15, 2005 1:01 am
Contact:

Re: Choosing a microcontroller platform

Post by rstofer »

This is another Atmel based controller. It is quite inexpensive considering http://www.digilentinc.com/info/cerebot.cfm
Gorgon
Posts: 325
Joined: Wed May 04, 2005 1:01 am
Location: Norway
Contact:

Re: Choosing a microcontroller platform

Post by Gorgon »

Philba:
I don't know what you have against Zilog, they botched it on the migration from Z80 to Z8000. But the new rise of the Z8 Encore! and eZ80 Acclaim development kits, are very good entry level kits. (Z8 do have DMA!!)<p>
I've done about 10 projects on the PIC controller, and I still can't(I do understand of course ;) ) understand why they are so popular. I have only programmed them in assembly and it is a pain every time.<p>The Z8 and the AVR has about the same programming model, and I like both of them.<p>The Cerebot module looks great, but the software support seems a bit iffy.<p>Don't forget Motorola or more correct Freescale, they have several good micros with demo and/or development kits: http://www.freescale.com/webapp/sps/sit ... eId=016246 <p>TOK ;)
Gorgon the Caretaker - Character in a childrens TV-show from 1968. ;)
User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: Choosing a microcontroller platform

Post by philba »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by Gorgon:
Philba:
I don't know what you have against Zilog, they botched it on the migration from Z80 to Z8000. But the new rise of the Z8 Encore! and eZ80 Acclaim development kits, are very good entry level kits. (Z8 do have DMA!!)<p>...
<hr></blockquote><p>Its not having something against zilog (I do like to see the underdog win) but its rather that avr and pic have incredibly broad offerings with a vast amount of resources available on the internet. Though the PIC makes even AVRs look under supported. For a relative beginner with microcontrollers, this is very important. <p>I did order the $10 z8 starter kit though it hasn't shown up - its back ordered big time. I'll play with it when it comes and may have a different opinion but at the end of the day, they are still a minor player.<p>Yes, the PIC is an ugly little beast when it comes to developing assembly language software. However, the amount of support makes it hard to ignore and the incredible broadness of the line is just astounding. If you program in C, its not nearly so ugly. PICs are very durable. I've amazingly abused my PICs (that sounds a tad perverse...) and have only blown one i/o pin that I know of out of 10 different pic types and about 50 or so prototypes. They get very hot if you get +5 and gnd reversed... <p>Microchip is very "hobbyist friendly" - no questions, they just send you the samples you ask for and have a very extensive collection of ap notes and such. (yes, atmel is pretty easy on samples, too) <p>Again, PICs or AVRs are what I recommend to beginners for all those reasons.<p>Phil
Newz2000
Posts: 507
Joined: Wed May 18, 2005 1:01 am
Location: Des Moines, Iowa, USA
Contact:

Re: Choosing a microcontroller platform

Post by Newz2000 »

Gorgon,<p>Did you use the Z8 for an automation project? If so, can you tell me how suitable it would be to do the following:<p>I need to drive several devices and read inputs at one time. For example, turn motor 1 to 180 degrees and stop, while turning motor constantly until button 1 is pressed while listening for a new command on serial port. This assumes a program being written in C, not assembly.<p>I've looked at all of the products mentioned and I'll admit the ATmega stuff looks cool, but most are > 50% more expensive than the Zilog kit. The Cerebot kit looks awesome and the price is good, but when you add the needed modules you're right back up there in price with the others.<p>There seems to be a good (enough) quantity of documentation for the z8 functions.<p>I think that I will use the pics or the z8 kit, leaning towards pic unless I can find someone who can specifically say that z8 will handle the above functions in a C program.<p>Just from my mild experimentation and little bit of research, the benefits of the PIC are it's very simple assembly language and broad user base.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 16 guests