Samsung S3F80JB Programming TIP To generate a one-pulse signal through P3.1, CADATAH,# Set 40 ms

Models: S3F80JB

1 346
Download 346 pages 34.13 Kb
Page 268
Image 268

S3F80JB

COUNTER A

 

 

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:

40 us

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

0100H

; Reset address

START:

DI

 

 

 

 

 

 

 

 

 

LD

CADATAH,# (160-2)

; Set 40 ms

 

LD

CADATAL,# 1

; Set any value except 00H

 

 

 

;

 

LD

P3CON,#11110010B

; Set P3 to C-MOS push-pull output.

 

 

 

; Set P3.1 to REM output

 

 

 

;

 

LD

CACON,#00000001B

; 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

 

LD

P3,#80H

; Set P3.7(Carrier On/Off) to high.

 

 

 

 

 

 

 

 

 

Pulse_out:

LD

CACON,#00000101B

; 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.

 

 

 

12-7

Page 268
Image 268
Samsung S3F80JB manual Programming TIP To generate a one-pulse signal through P3.1, CADATAH,# Set 40 ms, Cadatal,#