Samsung S3P80C5 User Manual page 243

8-bit cmos microcontrollers
Table of Contents

Advertisement

COUNTER A
F 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:
— 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
START
DI
LD
LD
LD
LD
LD
12-6
8.795 µs
17.59 µs
37.9 kHz 1/3 Duty
0100H
CADATAL,#(70-2)
CADATAH,#(35-2)
P2CON,#10101010B
CACON,#00000110B
P2,#20H
; Reset address
; Set 17.5 µs
; Set 8.75 µs
;
; Set P2 to C-MOS push-pull output.
; Set P2.1 to REM output
;
; 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.
;
; Set P2.5(Carrier On/Off) to high.
; This command generates 38 kHz, 1/3duty pulse signal
; through P2.1
;
S3P80C5/C80C5/C80C8

Advertisement

Table of Contents
loading

This manual is also suitable for:

S3c80c5S3c80c8

Table of Contents