Dealing with part shortage – Microchip edition

For a small electronics project of mine, I needed literally only one output pin. My go-to part for these situations is PIC10F200. It's a 6-pin SOT-23 device offering internal oscillator and not much more. Microcontrollers don't really get smaller/simpler than this.

Due to the hamster habits I have, I actually had enough enough parts to finish up the prototype so the only thing left was to order a few more parts of DigiKey. Well, as many components lately, my favorite PIC was out of stock.

However, when one door closes, another one opens. Microchip is really good at keeping pinout similar over multiple microcontrollers. And DigiKey had PIC10F202, PIC10F206, PIC10F220, PIC10F222, and PIC10LF322 available in stock. While all these PICs are slightly different, they share the same basic pinout. And for my project any of them would do. Even if I used some less common feature, Microchip often has multiple products differing only in memory amount.

While hardware might be similar enough, firmware does have significant differences - especially between older PIC10F206 and newer PIC10LF322 setup. Even turning LED on/off uses different registers between them. Instead of having different firmware for each, one can make use of compiler directives and check which PIC is actually being used. Something like this:

Code fragment
#if defined(_10F200) || defined(_10F202) || defined(_10F204) || defined(_10F206)
GP2 = 0; // turn off GP2
TRISGPIO = 0b11111011; // GP2 is output
#else
LATAbits.LATA2 = 0; // turn off RA2
TRISAbits.TRISA2 = 0; // RA2 is output
#endif

While out-of-stock syndrome has hit Microchip too, with a bit of care, they do make transition feasible if not always trivial.

Leave a Reply

Your email address will not be published. Required fields are marked *