COUNTER A
S3C80A5B
12-6
F
PROGRAMMING TIP — To Generate 38 kHz, 1/3duty Signal Through P2.1
This example sets Counter A to the repeat mode, sets the oscillation frequency as the Counter A clock source, and
CADATAH and CADATAL to make a 38 kHz,1/3 Duty carrier frequency. The program parameters are:
17.59
µ
s
8.795
µ
s
37.9 kHz 1/3 Duty
— Counter A is used in repeat mode
— Oscillation frequency is 4 MHz (0.25
µ
s)
— CADATAH = 8.795
µ
s / 0.25
µ
s = 35.18, CADATAL = 17.59
µ
s / 0.25
µ
s = 70.36
— Set P2.1 C-MOS push-pull output and CAOF mode.
ORG
0100H
; Reset address
START
DI
•
•
•
LD
CADATAL,#(70-2)
; Set 17.5
µ
s
LD
CADATAH,#(35-2)
; Set 8.75
µ
s
;
LD
P2CON,#10101010B
; Set P2 to C-MOS push-pull output.
; Set P2.1 to REM output
;
LD
CACON,#00000110B
; Clock Source
←
f
OSC
; Disable Counter A interrupt.
; Select repeat mode for Counter A.
; Start Counter A operation.
; Set Counter A Output Flip-flop(CAOF) high.
;
LD
P2,#20H
; Set P2.5(Carrier On/Off) to high.
; This command generates 38 kHz, 1/3duty pulse signal
; through P2.1
;
•
•
•