PIC microcontrollers
Posted: 13 Feb 2024, 14:06
I've been playing with one of the lower-end PIC microcontrollers - specifically the PIC12F675. These are simpler devices than the 8-bit Arduinos we typically use now, but still very capable. Phil used these for his early microcontroller-based encoders and there are very many of those in use, worldwide.
The 12F675 has only 64 bytes of 'RAM' and 1024 words of Flash memory programming space - those words are each 14 bits wide; it also has 128 bytes of EEPROM memory. You can program it in C, but it's more fun to use assembler - and its assembly language is very easy to learn with only 35 instructions available. The chip only has 8 pins, but it can do analogue inputs, and has timers, similar to the Atmel chips used in Arduinos. Of course, there is a whole family of PIC chips available, some of which have many more pins, bigger memory space, and more built-in peripherals.
You can't program PIC chips (as far as I know) using the Arduino IDE. Microchip provide the MPLAB X IDE free, which provides similar facilities to the Arduino IDE - and in some ways better, as it has a built-in debugger for the more capable chips, and an emulator for the smaller ones like the PIC12F675.
The only real barrier to entry is that, to make things simple, it's best to buy a PICkit 3 programming device - which cost £20 or more for genuine units. You can get much cheaper clones, but they may not work properly for all the PIC chips you'd like to program. Alternatively, you can use something like the XGecu T48 programmer, which works great, but doesn't integrate as cleanly with the MPLAB X IDE.
The 12F675 has only 64 bytes of 'RAM' and 1024 words of Flash memory programming space - those words are each 14 bits wide; it also has 128 bytes of EEPROM memory. You can program it in C, but it's more fun to use assembler - and its assembly language is very easy to learn with only 35 instructions available. The chip only has 8 pins, but it can do analogue inputs, and has timers, similar to the Atmel chips used in Arduinos. Of course, there is a whole family of PIC chips available, some of which have many more pins, bigger memory space, and more built-in peripherals.
You can't program PIC chips (as far as I know) using the Arduino IDE. Microchip provide the MPLAB X IDE free, which provides similar facilities to the Arduino IDE - and in some ways better, as it has a built-in debugger for the more capable chips, and an emulator for the smaller ones like the PIC12F675.
The only real barrier to entry is that, to make things simple, it's best to buy a PICkit 3 programming device - which cost £20 or more for genuine units. You can get much cheaper clones, but they may not work properly for all the PIC chips you'd like to program. Alternatively, you can use something like the XGecu T48 programmer, which works great, but doesn't integrate as cleanly with the MPLAB X IDE.