Could someone suggest books on PIC18F for me, I used Gaonkar for my classes, and I found Muhammad and Huang to be great references.
Electronic – Books about pic18f?
microcontrollerpic
Related Solutions
It's because you're looking at a new chip family. In the 8-bit PICs, the F used to mean flash based (aside from, IIRC, pic16c84 which was the first one) and are therefore more popular than the C series, which had to be erased with UV lights. Some of those didn't even have a window for that, making them one time programmable.
The actual processor families themselves are divided into numbers from PIC 10 to PIC 32 and dsPIC 33; of which 18 and lower are the well known 8-bit PIC family. I think these numbers once indicated the instruction width, but that changed somewhere (pic18f2550 has 16 bit instructions). The PIC24 I haven't looked closely at, but it's some sort of DSP cousin, and PIC32 isn't even based on the PIC processor architecture but MIPS. You'll find the PIC18 and lower are grouped under 8 bit microcontrollers, while the PIC24 is in the 16 bit category along with dsPIC 30 and 33 (yep, that's a higher number than the PIC32 which is 32-bit).
In short, the reason you're finding sample code that doesn't quite apply is because Microchip decided to use its well known PIC brand to market nearly all their microcontrollers. The effect you suffer from is known as brand dilution.
For a comparison, it's like the 10..18 families are like x86 processors from the 386 to the Pentium II, each time adding some instructions but largely similar to program, but the PIC24 is the sudden shift to a dissimilar IA-64 instruction set (Itanium) and the PIC32 is a third party product (like StrongARM). All those were made by Intel, but they avoided this level of confusion by not (at the time) branding the Itanium as a Pentium or Xeon device. AMD, on the other hand, is about to add some confusion with ARM architecture Opteron brand chips.
I've personally found in my limited experience of PIC programming, that the Microchip MPLABX IDE and the XC compilers had all the functionality that I needed. As far as I am aware, the only pitfalls I found were that the free version doesn't allow high compiler optimization of your code, but I didn't find it impacted negatively on what I was doing.
I haven't tried any "free" PIC alternatives, but knowing the amount of pain I went through trying to set up a GCC for GNU compiler in Eclipse, I can say that MPLAB X is an absolute breeze to pick up for beginners.
NOTE: Microchip don't make it obvious, but the C18 compiler you linked is actually an older generation. The XC suite being the new one.
For you, I would recommend getting the MPLAB X IDE and then installing the MPLAB XC8 compiler, which supports PIC12, 16 and 18. (Check under the Downloads button)
I have only the XC16 compiler installed currently, but when I run MPLAB X IDE and click New Project and select a PIC18 as the device, it asks me for a toolchain to work with like so (I'm given a choice between C18 and the XC8 all-in-one, though some PIC16's are only supported by XC8):
Once you have installed the XC8 and the X IDE, in it, you can just click File > New Project, and then under Samples you will find a C template and example "blinky" code for all the targets.
You will also need a picKit for programming or debugging your code on your target.
Don't hesitate to comment if I haven't explained something properly :)
Best Answer
The absolute best reference is PIC18F2525/2620/4525/4620 Data Sheet, or any of the similar documents for other 18F chips. The PICmicro Mid-Range MCU Family Reference Manual can also be a useful supplement. The datasheet and the family reference manual are the original source of all information relating to a PIC 18, so at best anything else doesn't garble it or omit things.
Microchip datasheets are well written and easy to follow, but still contain all the necessary information. If there are specific things you don't understand in them, you can ask here for clarification.
For more discussion on this topic, see my answer to Good book for PIC 18F beginner?.