Title: Microprocessors lesson 3 IO port, delays'
1 Microprocessors
lesson 3 I/O port,
delays.
2Topics lesson 3
- Questions / remarks
- Consolidation
- Organisation
- Logbook
- CC5x compiler users manual
- Preparation
- MPLab C-compiler
- Architecture Clock
- PICkit1 board
- Architecture
- PC definition
- Memory map
- Presentation
- I/O port
- LEDs
- PICkit1 board (hardware)
- Lab Problem 1
- Next week (3th hour)
- Delays introduction
3Device overview
Memory map
4Program memory map
5Memory organisationData
Memory map
6Hardware description (LEDs)
7Digital I/O (1)
FromReference Manuals for the mid-range MCU
Family (document 33023a)
My first problem
8Digital I/O (2)port code snip
/example set RA4 as digital output,
low level/ void initDIO() //see data sheet for
values ANSEL ?? CMCON0 ?? void
LED0() PORTA0x3F//reset all latches
TRISA0b.1110.1111//RA4 as output
PORTA0b.0001.0000// RA 4 High
9Design programs in C
- See CC5X users manualextensions and limitations
- Registers are predefined variables.PIC16Fxxx.H
file - Problems with simulation
10Presentations
11Lab
12Self tuition for next week
- Also see preparation lesson 4
- Finish Problem 1
- Logbook evaluation
- Start Problem 2
- Presentation about TIMER0
13Delay introduction
- Software
- Using clock cycles
- loop elements
- Hardware
- Timer device,
- polling based
- interrupt based.
14Delay(3) Software
- Advantage easy to program
- Disadvantage Difficult to make a exact time
delay - Disadvantage processor is busy in delay loop.
15Delay(2) software
//code snip Simple Loop uns z z0 Action()
while (zlt1270) //1270 is an example z
//Additional dummy statements //will make
the delay longer
16Delay(4) HardwareTimer module
- Separate hardware module.
- Easy to calculate.
- Advantage processor is free during timer count.
Clock cycles free for other activities
17Delay (5) Hardware Timer 0
8-bit timer/counter Readable and writable
8-bit prescaler (software programmable)
Internal or external clock select Interrupt
on overflow Edge select for external clock
18Problem 2
- Design and implement a running light
(LED0..LED7). - Software based on a loop.
- Hardwarebased on TIMER 0
19Logbook evaluation