EEE305 Microcontroller Systems Lecture 4: The PIC microprocessor and the Microchip C Compilers Teaching resources on on My office 5B18, telephone My 1/
Using C in the real world 2
3
4
5
6
Learn to use datasheets: Either from or E305 7
8
9
10
E305 11
I/O pins; PORTS A-E Similar but different E305 12
E305 13
E Ignore OPTION_REG for the moment; simple use of PORTB is achieved by setting up each pin as an input or output and then sending data to an output pin or reading data from an input pin. To configure a pin as an output set the corresponding bit in the TRIS register to zero.
E305 15
E305 16
E As well as the configuration symbols, such as the type of oscillator etc., we will also use symbols created for us to allow access to the special function registers (SFRs). Such as TRISB and PORTB. These are in uppercase
E305 18
E F877
MPLAB X and XC8 E As usual in these Integrated Development Environments (IDEs) you must be careful to specify a project name and folder BEFORE creating a source file. Acknowledgements: I have referenced material from Although this uses a slightly different processor much of his site is still valid Please read all 5 lessons – for your reading day next Friday.