+ All Categories
Home > Documents > EEE305 Microcontroller Systems Lecture 4: The PIC microprocessor and the Microchip C Compilers...

EEE305 Microcontroller Systems Lecture 4: The PIC microprocessor and the Microchip C Compilers...

Date post: 21-Dec-2015
Category:
Upload: rosamond-tucker
View: 217 times
Download: 0 times
Share this document with a friend
Popular Tags:
20
EEE305 Microcontroller Systems • Lecture 4: The PIC microprocessor and the Microchip C Compilers •Teaching resources on on www.eej.ulst.ac.uk •My office 5B18, telephone 028 90 366364 •My email [email protected] http://www.eej.ulst.ac.uk/~ian/modules/ EEE305 1/
Transcript

EEE305 Microcontroller Systems

• Lecture 4: The PIC microprocessor and the Microchip C Compilers

•Teaching resources on on www.eej.ulst.ac.uk

•My office 5B18, telephone 028 90 366364•My email [email protected]

http://www.eej.ulst.ac.uk/~ian/modules/EEE305 1/

2

Using C in the real worldwww.microchip.com

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

3

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

4

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

5

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

6

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

7

Learn to use datasheets:Either from www.microchip.com or www.farnell.co.uk

8http://www.eej.ulst.ac.uk/~ian/modules/EEE305

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

9

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

10

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

11

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

12

I/O pins; PORTS A-E Similar but different

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

13

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

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.

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

15

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

16

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

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

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

18

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

19

16F877

http://www.eej.ulst.ac.uk/~ian/modules/EEE305

20

MPLAB X and XC8As 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 Although this uses a slightly different processor much of his site is still validPlease read all 5 lessons – for your reading day next Friday.


Recommended