To Generate A One Pulse Signal Through P3.1 - Samsung S3F80JB User Manual

8-bit cmos microcontrollers
Table of Contents

Advertisement

S3F80JB
PROGRAMMING TIP — To generate a one-pulse signal through P3.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 P3.1 C-MOS push-pull output and CAOF mode.
— 44 pin package
ORG
START:
DI
LD
LD
LD
LD
LD
Pulse_out:
LD
0100H
CADATAH,# (160-2)
CADATAL,# 1
P3CON,#11110010B
CACON,#00000001B
P3,#80H
CACON,#00000101B
40 us
; Reset address
; Set 40 ms
; Set any value except 00H
;
; Set P3 to C-MOS push-pull output.
; Set P3.1 to REM output
;
; Clock Source → Fosc
; Disable Counter A interrupt.
; Select one shot mode for Counter A.
; Stop Counter A operation.
; Set Counter A Output Flip-Flop (CAOF) high
; Set P3.7(Carrier On/Off) to high.
; Start Counter A operation
; to make the pulse at this point.
; After the instruction is executed, 0.75 ms is required
; before the falling edge of the pulse starts.
COUNTER A
12-7

Advertisement

Table of Contents
loading

Table of Contents