ECE 453 – CS 447 – SE 465 Software Testing & Quality Assurance Instructor Kostas Kontogiannis
ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a...
-
Upload
estella-barker -
Category
Documents
-
view
220 -
download
0
Transcript of ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a...
![Page 1: ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a specific delay between two points in the program by.](https://reader036.fdocuments.in/reader036/viewer/2022082417/56649ef65503460f94c0a928/html5/thumbnails/1.jpg)
ECE 447: Lecture 8
Timer System (1)
![Page 2: ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a specific delay between two points in the program by.](https://reader036.fdocuments.in/reader036/viewer/2022082417/56649ef65503460f94c0a928/html5/thumbnails/2.jpg)
ECE 447: 68HC11 Timer System
1. Generating delays - imposing a specific delay between two points in the program by polling.
label 1
label2
instr1instr2
instrN
delay
2. Pulse accumulation - counting the number of pulses
![Page 3: ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a specific delay between two points in the program by.](https://reader036.fdocuments.in/reader036/viewer/2022082417/56649ef65503460f94c0a928/html5/thumbnails/3.jpg)
ECE 447: 68HC11 Timer System
3. Input capture - measuring the time between signal edges
4. Output compare - generating signals with the given timing characteristics
start stop
start stop
pulse width
single pulse periodical signal
period
![Page 4: ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a specific delay between two points in the program by.](https://reader036.fdocuments.in/reader036/viewer/2022082417/56649ef65503460f94c0a928/html5/thumbnails/4.jpg)
ECE 447: 68HC11 Timer System
5. Real Time Interrupt – Produce a period signal for the 68HC11.
period
The Real Time Interrupt will allow a piece of code to be executed at a given period. This can be used to implement a Real-Time clock.
![Page 5: ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a specific delay between two points in the program by.](https://reader036.fdocuments.in/reader036/viewer/2022082417/56649ef65503460f94c0a928/html5/thumbnails/5.jpg)
ECE447: Timer I/O PinsPA0 - Input Capture 3 (IC3)
PA1 - Input Capture 2 (IC2)
PA2 - Input Capture 1 (IC1)
PA3 - Input Capture 4/ Output compare 5 (IC4/OC5)
PA4 - Output Compare 4 (OC4)
PA5 - Output Compare 3 (OC3)
PA6 - Output Compare 2 (OC2)
PA7 - Pulse Accumulator Input (PAI)
![Page 6: ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a specific delay between two points in the program by.](https://reader036.fdocuments.in/reader036/viewer/2022082417/56649ef65503460f94c0a928/html5/thumbnails/6.jpg)
ECE 447: Setting and Clearing Event Flags
Example for Input Capture 1
Unusual procedure!!!
Set a flag Clear a flag
#define IC1F 0x04
TFLG1 = IC1F;
Cannot be done in software!!!
Set by a preselected edgeat the PA2 input
Cleared by writing 1 to thecorresponding bit location!!!
![Page 7: ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a specific delay between two points in the program by.](https://reader036.fdocuments.in/reader036/viewer/2022082417/56649ef65503460f94c0a928/html5/thumbnails/7.jpg)
ECE447: Measuring Pulse Widths
Timer overflows
100 s < width < 32.768 ms
width 100 s
width 32.768 ms
start stop
start stop
start stop
![Page 8: ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a specific delay between two points in the program by.](https://reader036.fdocuments.in/reader036/viewer/2022082417/56649ef65503460f94c0a928/html5/thumbnails/8.jpg)
ECE 447: Measuring intervals <216 clock cycles
start
0
FFFF
stop
![Page 9: ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a specific delay between two points in the program by.](https://reader036.fdocuments.in/reader036/viewer/2022082417/56649ef65503460f94c0a928/html5/thumbnails/9.jpg)
ECE 447: Measuring intervals <216
clock cycles (overflow)
start
0
FFFF
1 2
stop
![Page 10: ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a specific delay between two points in the program by.](https://reader036.fdocuments.in/reader036/viewer/2022082417/56649ef65503460f94c0a928/html5/thumbnails/10.jpg)
ECE 447: Measuring intervals >216 clock cycles
start
stop
0
FFFF
1 2 N=3
R
![Page 11: ECE 447: Lecture 8 Timer System (1). ECE 447: 68HC11 Timer System 1.Generating delays - imposing a specific delay between two points in the program by.](https://reader036.fdocuments.in/reader036/viewer/2022082417/56649ef65503460f94c0a928/html5/thumbnails/11.jpg)
ECE 447: Measuring intervals >216 clock cycles
start
stop0
FFFF
1 2 3
R2
R1
N=4
R1+R2=R