8-BIT TIMER A/B

S3C84E5/C84E9/P84E9

 

 

FPROGRAMMING TIP — To generate a one pulse signal through P4.3

This example sets Timer B to the one shot mode, sets the oscillation frequency as the Timer B clock source, and TBDATAH and TBDATAL to make a 40μs width pulse. The program parameters are:

40 μs

Timer B is used in one shot mode

Oscillation frequency is 4 MHz (fx=1/4 clock = 1 μs)

TBDATAH = 40 μs / 1 μs = 40, TBDATAL = 1

Set P4.3 to TBPWM mode

ORG

0100H

; Reset address

START DI

 

 

 

 

 

 

 

 

 

LD

TBDATAH,# (40-1)

;

Set 40 μs

LD

TBDATAL,# 1

;

Set any value except 00H

LD

TBCON,#00010001B

;

Clock Source fxx/4

;Disable Timer B interrupt.

;Select one shot mode for Timer B.

;Stop Timer B operation.

;Set Timer B output flip-flop (T-FF) high

LD

P4CONL, #03H

;

Set P4.3 to TBPWM mode.

 

 

 

 

 

 

PULSE_OUT:LD

TBCON,#00000101B

;

Start Timer B 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.

 

 

 

11-10

Page 254
Image 254
Samsung S3C84E5 Programming TIP To generate a one pulse signal through P4.3, TBDATAH,# Set 40 μs, Tbdatal,#, Pulseoutld