PIC microcontrollers

Arduino projects on the go
Post Reply
Martin
Posts: 745
Joined: 16 Feb 2018, 14:11
Location: Warwickshire

PIC microcontrollers

Post by Martin »

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.

User avatar
Phil_G
Posts: 608
Joined: 15 Feb 2018, 23:32
Contact:

Re: PIC microcontrollers

Post by Phil_G »

All good stuff Martin, nice to see these humble little controllers mentioned :)
Just to add, the cheap Chinese knock-off Pickits are every bit as good as the originals, I've a couple of each, cant tell real from clone :)
I like to keep it simple, never used a debugger, simulator or higher level language and I dont bother with any sort of IDE at all,
I write source in notepad and assemble it with MPASM (used to be MPALC) then program the chip using the PICkit software.
As Martin says you soon learn the minimal instruction set by heart and then you just write freely, I find it very satisfying.
I did once help someone with PICbasic and actually found was a very good way to introduce him to assembler, as picbasic
uses a lot of assembler constructs.
The other thing to mention is across the mid-range PICs 99% of the code is compatible, its the same instruction set
though some have features that others dont. If you outgrow the 8-pin12F675, with very minimal changes the same
code it will run on a 14-pin 16F684 or a 20-pin 16F690.
As with any 'new' system - start by flashing an LED and grow from there! :D
Cheers
Phil
bluejets
Posts: 318
Joined: 19 Jun 2019, 04:09

Re: PIC microcontrollers

Post by bluejets »

Martin wrote: 13 Feb 2024, 14:06

You can't program PIC chips (as far as I know) using the Arduino IDE.
https://diyodemag.com/projects/arduino_ ... Arduino.
User avatar
Phil_G
Posts: 608
Joined: 15 Feb 2018, 23:32
Contact:

Re: PIC microcontrollers

Post by Phil_G »

'Programming' as in 'blowing' is a different thing Jeff, I think what Martin meant was you cant write PIC programs
in the Arduino IDE, ie in Arduinos variant of c++. There is an official c compiler for PICs (I've never used it) but
as far as I'm aware its never been integrated into the Arduino IDE.

I think 'Programming' as in 'blowing' a file onto the PIC chip isnt worth messing with Arduinos when you can get a Pickit for £20 or less :)
Its an investment - the right tools for the job :)

Cheers
Phil
Grif
Posts: 8
Joined: 10 Oct 2022, 16:01

Re: PIC microcontrollers

Post by Grif »

Phil: If you have a hammer, everything looks like a nail.

Hope it's a valid cross cultural analogy... ;-)
Post Reply