Well i want to try to learn how to program some pic microcontrollers and i know nothing. right now i am getting over wellmed and i need some guidance.
What is some easy reading that will show working sample code and how it works, how i can use it to make more complex things?
the most i gotten in to was some arduino code that worked as a ROM switcher for my Commodore 64 witch i have working and works good switching 4 banks ina nd out on my EPROM. And a 10M CW beacon for a friend but that was all code that i found online.
I ordered some PIC12F675 to upload "picdiv" for an over complicated digital clock running off a 10Mhz OCXO because i was board and it would be cool.
but i would all so like to play with the PIC12F675 i ordered the only thing i seen on youtube was people making lights blink.
Hi there,
If you want to get started with the PIC chips you should check out the forum for that there is a forum just for Microchip products. They have people that help there. They had a better forum before that, but for some reason they seem to have switched to a different one.
Anyway, it is true that PIC chips are harder to program than Arduinos, but if you go to the Microchip site (or whatever they call it now) you can download examples. They have quite a collection last time I checked.
Assembler for the 12F675 is not that bad because there are not many instructions to learn, but if you never programmed like that it may be hard to grasp. You have to visualize what each instruction does and how it affects the registers and the outside world pins.
Also, the 12F675 is probably the easiest chip to learn that also has a built in AD converter, and you definitely want that or you miss out on a lot.
Programming in ASM (assembler) means you will also learn the registers in the chip, and there are quite a few registers. To see if this is something you might want to do, download the data sheet for the chip and take a quick look through it. See if the descriptions of the registers make sense to you. If they don't you will have to read more on this or watch some videos.
The registers control everything, even the clock speed. To use the AD converter or the built in EPROM you will have to look up code for that because there are special sequences you have to execute to get these to work, although some of that may be on the data sheet. They also control the interrupts.
There's also another pdf file that you should download that tells you the basic operation of the mid range chips. It's the reference manual for Midrange Pic chips.
If you have doubts that your current programmer can handle a pic like the 12F675, you might download the programming reference manual also, but it may be hard to follow.
ASM is great if you want to take complete control over every aspect of the chip. You can see what every step is doing. It takes longer to write a program though, and to do math you usually have to download a math library. That would be a set of code you use in a routine to do the regular math like adding 32 bit numbers and stuff like that. If you intend to display any data on an LCD, you also need a conversion routine to convert from the N bit 'hex' numbers into M digit decimal representation. For example, 0x0F would convert to "15" which you could then send to the display.
The C language makes it faster to program, but you do lose some of the details of the why the chip handles certain operations. A lot of people choose this though because with ASM it takes a long time to produce a complex program.
There's also memory 'banks' that you have to consider, via none other than the registers. Some registers are stored in one bank, the others in the secondary bank. You have to pay attention when to switch banks if using ASM. The 12F675 has two banks, and some chips have more than two banks.
It can be a lot of fun to get one up and running after studying the resistors and the instructions.
If you get the PICKit 3 you will of course get a manual with that which should get you started. I have not used that particular one though so I can't say how good it works. You do have to make sure the kit you get handles your chip, if you end up getting a ready made programmer.
They also make prototype boards with support components. They would also come with examples and also you can program the chips with that, but the chip parts they can handle may be limited you'd have to check that.
One of the nicest things about the PIC chips is that you can use the low power mode, and also set the chip into a sleep mode. This allows you to use very little power for applications that only have to measure something once in a while, like every 10 minutes or something like that. You can create a temperature meter for monitoring a freezer that uses two AA batteries and they last for 2 years. This is harder to do with the Arduino, but if you like using the chip they use for the Uno for example you can learn to program that or use the IDE and a programmer and start with the raw chip. That would be a bit more versatile although you have to add support components.
There are a lot of options out there:
1. Raw Pic chips.
2. Development board for Pic chips.
3. Raw Arduino chips.
4. Arduino dev boards.
It's amazing what these chips can do. Years ago it would take a LOT more hardware to get even close to what these chips can do. I've been involved in development of such hardware years ago and it was almost nuts compared to today with the huge number of microcontrollers out there.