Download digital interfacing and software

Transcript
Contents
1. Introduction
1.1. Microcontroller usage in control engineering . . . . . . . . . . . . .
1.2. This project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1.3. About this report . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2. Software architecture
2.1. Modularization . . .
2.2. Interrupts . . . . . .
2.2.1. Interrupts and
2.3. Module overview . .
. . . . . . . . .
. . . . . . . . .
the Z8Encore!
. . . . . . . . .
3. Timer module
3.1. Hardware description . . . . . .
3.2. Implementation . . . . . . . . .
3.2.1. Disabled interrupts . . .
3.2.2. Race conditions . . . . .
3.2.3. Timer counter behaviour
3.3. Summary . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5
5
6
6
.
.
.
.
7
7
8
9
10
.
.
.
.
.
.
12
12
12
15
16
17
18
4. Callback module
4.1. Usage . . . . . . . . . . . . . . . . . . . . . . .
4.2. Implementation . . . . . . . . . . . . . . . . . .
4.2.1. Timer wrap-round . . . . . . . . . . . .
4.2.2. Multiple deadlines . . . . . . . . . . . .
4.2.3. Adding callbacks . . . . . . . . . . . . .
4.2.4. Adding callbacks from within a callback
4.2.5. Callback behaviour after blocking . . . .
4.2.6. Module initialization . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
19
20
20
24
25
26
29
29
30
5. Display module
5.1. Hardware . . . . . . . . . . . .
5.1.1. The seven-segment digits
5.1.2. Multiplexing . . . . . . .
5.1.3. Digit patterns . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
31
31
31
32
32
2
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.