-
Finally giving up on those ancient PICs
03/17/2025 at 08:36 • 0 commentsStill on the lookout for what to do with these ancient MCUs so I decided to try the most recent 3.0 release of the xc8-cc compiler. This can be run from the command line, the most important thing is to use the -mcpu=16c57 argument (for example) to specify the model one is compiling for. The language implmentation is actually quite decent and I could compile a source file from a project for another MCU with small changes.
But here's the brick wall I hit:
Only two levels of PC stack! What were they thinking? The compiler did warn me that the program required more stack than available. In a post, I think it was on StackExchange, someone wrote that early PIC programmers had to do heroic things to flatten the program to fit, inlining, state machines, and other tricks. It would be more difficult to do in C compared to assembler but a PITA in any language. It seems like they only intended the early PICs to be used for small simple applications, e.g. to replace discrete logic.
To Microchip's belated credit they've increased the stack size in newer PICs to 8 and programming is no longer a pain.
Even if I accepted the challenge to mangle my programs to fit the stack and I could order a flash counterpart to the OTP 16C57, the 16F57, to debug programs, why pay a few bucks for one NOS 16F57 when that can buy 10 far more capable RISC-V MCUs for that money?
The other thing I could do is flash an already tested program onto the chips. Besides the dice program, I also discovered an IR decoder program for the schematic above. But I don't have a pressing need for either a dice or an IR decoder in my life. So these ancient chips will continue to languish in my junk box.