keskiviikko 16. huhtikuuta 2014

Tiny PICs: Neat little chips

As previously said, I had handful of PIC10F206 and PIC12F509 remaining from an old project. Dates on the chips indicate that they were manufactured late 2004 and mid 2005, so I'm guessing I bought them late 2005.

These chips really are fascinating, albeit in perverse sort of way if you are more used to bigger chips commonly available today. They come in 6-pin (surface mount) or 8-pin (DIP) packages, with up to 6 GPIO lines available, depending on chip and configuration. Not much memory either; smallest of them (PIC10F200) has whopping 256 word flash (do read that again: 256 words. Don't let the "word" confuse you; PIC uses 12-bit instructions and one such instruction is referred as "instruction word", so in essence that flash has room for 256 assembly instructions) and 16 bytes (bytes!) of SRAM.

Operating voltage can be anything between 2.0 and 5.5v and they use about 350μA when running on internal RC oscillator at full 4 MHz speed (that at 5v, less at smaller voltages). At sleep they use less than 100nA. These figures are pretty impressive. Yes, nothing spectacular by today's standards compared to say MSP430 or Energy Micro products, but remember, these are 10-year old chips that cost about 1€ apiece at your local electronics store and some cents in volumes.

Then the serious drawbacks; no interrupts. Yes, you read that right, no interrupts at all. The closest thing is that they can wake from sleep (that's the 100nA mode) when activity is detected on some pins or watchdog expires. The gotcha is however that "wakeup" doesn't resume operation from the last execution point but instead does full chip reset, including resetting the GPIO's tristate buffers to default mode (all I/Os input - not fun if you want to hold some output line for longer periods). At least you can programmatically determine whether reset was due to change in I/O, power-on reset or watchdog and proceed accordingly, but there still will be a short output drop during reset.

Now, considering that there are no interrupts, the fact that they do have a timer module (some of them at least) is a bit perplexing. What can you do with a timer that can't generate interrupts? Especially since it can't be used to wake processor from sleep either. But then again, it appears to be capable of counting external pulses (with optional divider), so it might be one use for it (you can access its internal counter directly, although brief glance over datasheet seems to imply that timer module is disabled during sleep making that less useful feature).

All this makes writing software for them somewhat difficult, especially if you are used in working with more usual MCUs. I admit, it took me a while to get used in thinking really small.

All this being said, don't get me wrong, I absolutely do not recommend these chips as primary MCU for miscellaneous projects, these are absolutely not suited that. For general purpose MCU pick a suitable suitable AVR (Arduino) or some equivalent PIC18 instead. But if you have very specific need for small device these may be worth the trouble.

Now, look at those voltage and current figures again.Wouldn't this thing be just perfect for a battery-operated widget that only has to wake up every now and then to do briefly something and then return to low-power mode? Yep, more about that next time. For now I'll just leave you with a small teaser:













What could it be?

 

Ei kommentteja:

Lähetä kommentti