If the interrupt was triggered by TIMER0 overflow, the routine first presets TMR0L counter to
desired timing until the next overflow. This timing depends on the Brightness register, which is
in range 0x00 (lowest intensity) to 0x0F (highest intensity). As PWM regulation is used, one
Anode period (or 1/8 of total display refresh cycle) contains two interrupts: ON period, and OFF
period. Flag,4 is toggled at every interrupt, and it determines if ON or OFF cycle is in progress.
In the first cycle, one Anode is active, and in the second one, all Anodes are OFF. Both timings
are determined by register Brightness: ON period is (Bri1) × 52µs, and OFF period is
(16-Brightness). The whole period is always 833 µs. Individual timings for each Brightness
setting is read from lookup table, so that the intensity regulation is approximately logarithmic.
If Pause flag (which is in Flag,0) is reset, display routine will output Buffer (16 bytes), and if it is
set, BufferPause (16 bytes) contents will be output.
After display driving, Interrupt routine tests all keys (except for the Reset key, of course).
Debouncer uses registers ROTOR0...ROTOR4, to shift left each key input. If ROTORx state is =
11111110, the falling edge is detected and debounced (after seven "key off" states) so one of
bits 0...4 in register KeyEdge will be set. If user routine has to test if some key was JUST pressed
(signal transition from HIGH to LOW), it should test one of those bits and reset it after it detects
that it was set (it is not automatically reset). If user routine has to test if some key is
permanently pressed, it has to test bit 0 in one of ROTOR0...ROTOR4 registers. It is NOT
recommended to test port pins directly (except for the INT key), as keys 1...4 have only one
common input.
Special test is made for Left+Right+Up and for Left+Right+Down keys, as those combinations
are used for display brightness adjusting. Left and Right key are tested for permanent pressing
(bit 0 in Rotor1 and in Rotor4), and Up and Down keys for edge detection (bit 2 and 3 in
KeyEdge register), so it is required that user holds down keys Left and Right at the same time,
and presses keys Up and Down to adjusts brightness. If those conditions are met, the new
Brightness contents are written in Eeprom, at address 0x00. After the Reset condition, on
power up, kernel will return this value in register Brightness.
Key INT has a special function. When pressed (which is still not detected via Interrupt process,
but via simple polling), kernel will set the Pause flag (which is in Flag,0) and display routine will
redirect from Buffer (16 bytes) to BufferPause (16 bytes) contents.
If Pause flag is already set and INT key is pressed, kernel will execute Sleep process. It will
switch off all anodes and power supply to all external devices, then pull all other outputs low.
Then it will reset INTCON,INT0IF flag, to avoid false wake up and INTCON,TMR0IE. It will also set
INTCON,INT0IE to enable wake-up. Then it will enter sleep mode. So it slleps inside the
interrupt routine.
Содержание SUPERCONFERENCE BADGE
Страница 1: ...HACKADAY SUPERCONFERENCE BADGE Pasadena 2016 Nov 5 6 Ver 1 Rev 0 ...
Страница 7: ......
Страница 14: ......