Presentation is loading. Please wait.

Presentation is loading. Please wait.

EEE305 Microcontroller Systems Lecture 4: The PIC microprocessor and the Microchip C Compilers Teaching resources on on www.eej.ulst.ac.ukwww.eej.ulst.ac.uk.

Similar presentations


Presentation on theme: "EEE305 Microcontroller Systems Lecture 4: The PIC microprocessor and the Microchip C Compilers Teaching resources on on www.eej.ulst.ac.ukwww.eej.ulst.ac.uk."— Presentation transcript:

1 EEE305 Microcontroller Systems Lecture 4: The PIC microprocessor and the Microchip C Compilers Teaching resources on on www.eej.ulst.ac.ukwww.eej.ulst.ac.uk My office 5B18, telephone 028 90 366364 My email IJ.McCrum@ulster.ac.uk http://www.eej.ulst.ac.uk/~ian/modules/EEE305 1/

2 Using C in the real world www.microchip.com http://www.eej.ulst.ac.uk/~ian/modules/EEE305 2

3 3

4 4

5 5

6 6

7 Learn to use datasheets: Either from www.microchip.com or www.farnell.co.ukwww.microchip.comwww.farnell.co.uk http://www.eej.ulst.ac.uk/~ian/modules/EE E305 7

8 8

9 9

10 10

11 http://www.eej.ulst.ac.uk/~ian/modules/EE E305 11

12 I/O pins; PORTS A-E Similar but different http://www.eej.ulst.ac.uk/~ian/modules/EE E305 12

13 http://www.eej.ulst.ac.uk/~ian/modules/EE E305 13

14 http://www.eej.ulst.ac.uk/~ian/modules/EE E305 14 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.

15 http://www.eej.ulst.ac.uk/~ian/modules/EE E305 15

16 http://www.eej.ulst.ac.uk/~ian/modules/EE E305 16

17 http://www.eej.ulst.ac.uk/~ian/modules/EE E305 17 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

18 http://www.eej.ulst.ac.uk/~ian/modules/EE E305 18

19 http://www.eej.ulst.ac.uk/~ian/modules/EE E305 19 16F877

20 MPLAB X and XC8 http://www.eej.ulst.ac.uk/~ian/modules/EE E305 20 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 http://www.gooligum.com.au/tut_midrange_C.html http://www.gooligum.com.au/tut_midrange_C.html 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.


Download ppt "EEE305 Microcontroller Systems Lecture 4: The PIC microprocessor and the Microchip C Compilers Teaching resources on on www.eej.ulst.ac.ukwww.eej.ulst.ac.uk."

Similar presentations


Ads by Google