Samsung S3P80C5 User Manual page 244

8-bit cmos microcontrollers
Table of Contents

Advertisement

S3P80C5/C80C5/C80C8
F F
PROGRAMMING TIP — To Generate a One Pulse Signal Through P2.1
This example sets Counter A to the one shot mode, sets the oscillation frequency as the Counter A clock source,
and CADATAH and CADATAL to make a 40 µs width pulse. The program parameters are:
— Counter A is used in one shot mode
— Oscillation frequency is 4 MHz (1 clock = 0.25 µs)
— CADATAH = 40 µs / 0.25 µs = 160, CADATAL = 1
— Set P2.1 C-MOS push-pull output and CAOF mode.
ORG
START
DI
LD
LD
LD
LD
LD
Pulse_out:
LD
0100H
CADATAH,# (160-2)
CADATAL,# 1
P2CON,#10101010B
CACON,#00000001B
P2,#20H
CACON,#00000101B
40 µs
; Reset address
; Set 40 µs
; Set any value except 00H
;
; Set P2 to C-MOS push-pull output.
; Set P2.1 to REM output
;
; Clock Source ← f
OSC
; Disable Counter A interrupt.
; Select one shot mode for Counter A.
; Stop Counter A operation.
; Set Counter A Output flip-flop (CAOF) high
; Set P2.5(Carrier On/Off) to high.
; Start Counter A operation
; to make the pulse at this point.
; After the instruction is executed, 0.75 µs is required
; before the falling edge of the pulse starts.
COUNTER A
12-7

Advertisement

Table of Contents
loading

This manual is also suitable for:

S3c80c5S3c80c8

Table of Contents