Thursday, December 9, 2010

Programming on the PIC18F4520 microcontroller

Yes! I am finally doing this. The code below was used by me for programming on the PIC18f4520 microcontroller for our Embedded Controls and Applications (ECAPP) project. This took a while to come up here as a post because I could not locate the actual file that I had saved. As a matter of fact, I am still searching for it.

The code below is the second to the latest version that I had used for the project with my group. It has not been complete as per out project requirements and therefore may contain bugs and errors, particularly in the comments section. Some of the comments that denotes values used in the main() and the ADC portion may not match the actual values that the functions are designed to do. The names of variables and functions may look a little vague, this is because they are closely related to the topic given and were meant to simulate various conditions in the project. If you know what you are looking for, you will understand what you are looking at with minimal effort.

The code below consists of topics that cover areas such as interrupts, timers (all three), ADC, PWM, CCP/CCPCON, Serial ports and the related code to configure the COM ports. Note that the code used to configure the LCD is configured as a separate lcdheader.h file. All of the programming is written in C and compiled and run using MPLab from Microchip Technology Inc.

Note: All the code below is publicly made available with my group mates' consent.