
TIMERS and TIMER/COUNTERS
S3C7559/P7559
11-6
BASIC TIMER COUNTER (BCNT)
BCNT is an 8-bit counter for the basic timer. It can be addressed by 8-bit read instructions.
RESET leaves the
BCNT counter value undetermined. BCNT is automatically cleared to logic zero whenever the BMOD register
control bit (BMOD.3) is set to "1" to restart the basic timer. It is incremented each time a clock pulse of the
frequency determined by the current BMOD bit settings is detected.
When BCNT has incremented to hexadecimal 'FFH' ( 255 clock pulses), it is cleared to '00H' and an overflow is
generated. The overflow causes the interrupt request flag, IRQB, to be set to logic one. When the interrupt
request is generated, BCNT immediately resumes counting incoming clock signals.
NOTE
Always execute a BCNT read operation twice to eliminate the possibility of reading unstable data while
the counter is incrementing. If, after two consecutive reads, the BCNT values match, you can select the
latter value as valid data. Until the results of the consecutive reads match, however, the read operation
must be repeated until the validation condition is met.
BASIC TIMER OUTPUT ENABLE FLAG (BOE)
The basic timer output enable flag (BOE) enables and disables basic timer output to the BTCO pin at I/O port 0
(P0.3). When BOE is logic zero, basic timer output to the BTCO pin is disabled; when it is logic one, BT output to
the BTCO pin is enabled. A
RESET clears the BOE flag to "0", disabling basic timer output to the BTCO pin.
When the BOE flag is set to "1" and the BCNT register overflows, the overflow signal is sent to the BTCO pin.
BOE can be addressed by 1-bit read and write instructions.
Bit 3
Bit 2
Bit 1
Bit 0
F92H
TOE1
TOE0
BOE
0
BASIC TIMER OPERATION SEQUENCE
The basic timer's sequence of operations may be summarized as follows:
1.
Set BMOD.3 to logic one to restart the basic timer
2.
BCNT is then incremented by one after each clock pulse corresponding to BMOD selection
3.
BCNT overflows if BCNT 255 (BCNT = FFH)
4.
When an overflow occurs, the IRQB flag is set by hardware to logic one
5.
The interrupt request is generated
6.
BCNT is then cleared by hardware to logic zero
7.
Basic timer resumes counting clock pulses