Twenty years ago I built a gadget based on a Zilog Z8 8-bit processor and a
2716 Eprom. I want to re-do the entire design using a more modern chip -- preferably in the PIC family (a DIP device that so I can wire up the board on the kitchen table).
The software was written in assembly language, and I was proud that the code was tight enough to occupy less than 1K. It also requires about 50 bytes of variables (scratchpad registers).
On the hardware side, it requires a real-time clock (with prescaler, it generates 1 msec interrupts) and only one input line and 8 output lines. Blazing speed is not necessary (the Z8 was clocked at 8 MHz.)
I know these are fairly modest requirements. The biggest problem was that the Z8 was a power-hungry NMOS device and is probably obsolete now. I still want to use assembly language, so I'd like to avoid BASIC-Stamps.
Any suggestions for choosing an OTP DIP (or SIP) device? Thanks in advance.
You might want to think about the 8051 as you will probably find it much easier to get to grips with its assembly language if you are familiar with the Z80. The PIC is odd to say the least, even to the point of using the word file to mean register.
If you don't specifically need an OTP, flash has become rather popular. That would allow you to reprogram without having to (re)buy more chips. I'd probably recommend avoiding the Microchip PIC families, unless you actually enjoy a little self-flagellation when writing assembly (as I do.) Also, there are other families with better programmers and debugging facilities at much lower cost.
Another modern change is that many micros do NOT need an external oscillator to operate and/or accept a modest valued resistor to set the speed. If you can accept some "tolerance" on your 1ms timing, you could also consider using some CPUs without a crystal. Some of the Cygnal devices claim a +/-2% tolerance on their ring oscillator over temperature and parts, if memory serves, but they are generally expensive parts (however, their "getting started" kits aren't too bad.) Some other chips vary much more widely, though. You'd probably need to say what precision you require for your timing to get some specific suggestions.
DIP does eliminate some choices, though. For example, I don't think those Cygnal parts are available in DIP. The same is true for the Texas Instruments MSP-430 -- no DIP. This means Microchip PIC and Atmel AVR and Motorola 908 'Q' family and some 8051 incarnations (such as Atmel's) that I'm sure Jim Granville will be happy to discuss. When I think of DIP, I'm usually using Atmel or Microchip, though. And of those, I'd probably recommend Atmel's AVR, since there is a very nice development/programmer board available at fairly low cost with LEDs and pushbuttons and a bunch of sockets for various parts, plus the software to make coding and testing darned easy without working at it.
Which makes me curious... Is there a DIP packaged CPU (hopefully a line of CPUs) that is flash programmable, includes something equivalent to jtag debugging and programming, and includes a relatively inexpensive programmer/debugger board (with proto area??)? Something along the lines of the Cygnal 8051 or TI MSP430 lines, but in offered in DIP?
The F628A is very nice and popular and cheap. A good choice where a lot of folks have already beaten down the brush and made nice, easily walked paths.
15 pin DIP? Cripes, I must have missed out! ;)
I've a tube of the F1320's laying around for playing. Good DIP part for most anything.
But all this is PIC and finding a nice emulator/jtag is expensive (ICE 2000 ain't cheap, though I have one here.) I was wondering about something else in DIP with built in JTAG debugger/programming and excellent tools, etc.
With flash, there is always the internal functional units needed to erase -- such as charge pumps, etc. And the cells are somewhat different, as well. With OTP, there are no facilities for erasure... or programming. No charge pumps, no write logic, etc. Meaning... supposedly, it's said... a little more security that something in software or some soft error caused by a cosmic ray turning on the charge pumps won't cause trouble. (No idea, if it's just paranoia. I'm too ignorant of the details to be certain.)
Those flash units have background debug, which you can use with the ICD2 for a reasonable price, I think it's around $150 if you pay full price- lets you single step and so on (even inside ISRs) from inside MPLAB. Since you don't want a compiler, the free tools should suffice, especially for just ~1K of code. Between the single breakpoint of the ICD2 and the MPSIM simulator, doing a 1K job should be pretty easy.
It eats up some resources including a few port pins and some code and data memory- see the data sheets etc. for the gory details.
Yes, understood. It is something I'm VERY concerned with, but I've not seen, nor heard of, a problem. I don't enable low voltage programming ever in production units. The programming mode thus requires a high voltage on /MCLR Vpp pin, either to do the programming or to enable it.
Microchip has been fooling with using a code to enable programming and having LVP enabled full-time as I understand it, on some newer units. Not sure I trust it. The code is the ASCII for their ticker symbol.
Best regards, Spehro Pefhany
"it's the network..." "The Journey is the reward"
firstname.lastname@example.org Info for manufacturers: http://www.trexon.com
SiLabs web info is not super-clear, and they also seem to be in transistion from a C8051F330P [DIP24] to a C8051F330D [DIP20] for DIL/low volume use.
Still, Mouser show both in stock, with the 330D @ $4.27/100, so it is more expensive than the jellybean PICs, BUT it has the on Chip DEBUG, and 8KF/768Ram/PCA/SPI/10bADC and 25 MIPS core - ALL in a nice DIP20 package :)
Another option for testing/low volumes, is the C8051F064EK, which is a surprisingly low cost ($25) Module, with serious ADC and Dual USB.
There are some market sectors that stipulate High Voltage or Hardware enable on FLASH, and there is also a trend to offer new uC in FLASH _and_ ROM models, and I suspect it is not _just_ price, but also the improved field reliability, that drives this move.
These devices are called ROM, and sold as ROM-flows, but may be flash die derivatives, with faster test flows, and erase disabled.
A Z8 should be available for a fairly direct upgrade. The classic Z8 architecture was still available the last time I looked and should be compatible with your old device. After cornering a large segment of the TV controller market, they consume very little power and most have a power down mechanism to consume less.
The great thing is your code should load fairly directly and event cycle times should scale or be constant with the same clock frequency.
Thanks to all who replied. Please bear with me because I am a (dare I say?) hobbyist. Is that the sound of doors slamming :)
I'm happy to hear that the Z8 is still kicking, and in CMOS. I'll probably need an external xtal because timing is fairly critical -- the application in fact measures time intervals and must have at least 0.1% accuracy.
Yes, I think I need 1 bit input plus 8 bits output. The outputs have to drive three 7-segment LED digits w/ decimal points. So I use 3 digit select lines, 4-bit BCD data, and one bit DP, making 8 output lines in all. I suppose I could use a 1-of-3 selector to decode just 2 lines, but I hate to add an extra chip.
If I only needed 8 I/O lines instead of 9, would that open a lot more options?
Yes, but you missed the question, then. I'm talking about including jtag debugging through an inexpensive adapter to a PC. In other words, something where the toolset allows me to use a tiny header on my target board to quickly compile, download to flash, and single step or run to breakpoints. PIC18F won't do that, as I know from personal experience. I do have an ICE 2000 emulator probe for the 18F, but then I can't have the actual target board -- I need a socketed arrangement because the actual CPU cannot be there. I don't know about the ATmega, having only used the smaller AVRs -- but those AVRs are NOT single step or run to break. Nice programming board, though. I like it. But not the same thing, really. Re the freescale, I cannot say -- I'll have to look. But given that you didn't get one (or maybe two) right, I'm not sure you understood when adding that one, either.
Are you planning on using a BCD to 7-segment decoder/driver, like the 7447, to generate the display segments? One thing you may not realize is that on these newer microcontrollers, at least some of them anyway, their sink and source capability is almost decent for LED driving, even when multiplexed. Sink and source impedances of 70 ohms or so are possible and if you open that up to around 120 ohms or so, a number of them fit the bill. If you want repeatable appearance, regardless of the number of digits, you'd need three transistors, but I've actually just used a pin (or two) to provide the common anode or common cathode drive with decent results in three-digit systems. Also, some of those
7-seg displays look pretty decently bright on only a few mA (say 2.5mA using a
680 ohm resistor for each segment, but then muxed by 3, so 2.5mA/3 or about
0.8mA average -- the current variance isn't so much with 680 ohm per seg.)
The AVR Megas have jtag debugging, with single-stepping and (3?) hardware breakpoints. The official Atmel jtag debugger is pretty expensive, but there are cheap clones available from Olimex. AVRs are nice to work in in assembly (they are not nearly as C-friendly as their marketing stuff claims, although they are better than most 8-bitters).