![](mdy_busstop01.gif)
| |
Description of Program
(Bus)
![](_themes/neontv/neoarule.gif)
¡@
Flowchart for Bus Program
![](Pbus.JPG)
¡@
Simple
description of Bus Program:
When the program is
started, the buffer register and flag will be initialized, and then the main
loop waits for the interrupt.
ƒ° The main loop will start, if got the interrupt, it will scanned four column by
the keypad, if there are 4 column scanned, it will check have any key is press,
then find the key which is pressed and corresponding seven segment display from
the database.
ƒ° If the program haven¡¦t scanned all four columns or cannot detect any key
press, then it will go back to the main loop.
ƒ° After find the corresponding display, the program will update the display
buffer and find which key cycle is. Refer to the table P1. If the key valid is
in this cycle, it will set the valid flag of the cycle. If no, it will clear the
valid flag of the cycle.
Then it will check the four valid flag is set all or
not. If no, it will return to the main loop to repeat the program. If yes, it
will send the output signal form the display buffer with last bus switch (Refer
to the table P2). Then will clear all the flag to return back to the main loop
and repeat the program again.
¡@
Table P1 |
Key in cycle |
Code |
1 |
2 |
3 |
4 |
D2 |
D1 |
D0 |
Null |
0 |
0 |
0 |
0 |
0 |
1 |
A |
0 |
0 |
1 |
0 |
0 |
2 |
A |
0 |
1 |
0 |
0 |
0 |
3 |
A |
0 |
1 |
1 |
¡@
¡@
¡@
¡@
¡@
¡@
Table P2 |
Last bus switch |
Light Bulb |
Code |
D3 |
Pressed |
On |
1 |
Released |
Off |
0 |
¡@
¡@
¡@
¡@
¡@
Back
|