Programming Timer 0 - Samsung S3C80A5B User Manual

8-bit cmos
Table of Contents

Advertisement

S3C80A5B
F
Programming Tip — Programming Timer 0
This sample program sets timer 0 to interval timer mode, sets the frequency of the oscillator clock, and determines
the execution sequence which follows a timer 0 interrupt. The program parameters are as follows:
— Timer 0 is used in interval mode; the timer interval is set to 4 milliseconds
— Oscillation frequency is 6 MHz
— General register 60H (page 0) ← 60H + 61H + 62H + 63H + 64H (page 0) is executed after a timer 0 interrupt
ORG
VECTOR
ORG
VECTOR
ORG
RESET
DI
LD
BTCON,#0AAH
LD
CLKCON,#18H
CLR
SYM
CLR
SPL
LD
T0CON,#4BH ;
LD
T0DATA,#5DH
SRP
#0C0H
EI
0FAH
T0OVER
0FCH
T0INT
0100H
; Timer 0 overflow interrupt
; Timer 0 match/capture interrupt
; Disable all interrupts
; Disable the watchdog timer
; Select non-divided clock
; Disable global and fast interrupts
; Stack pointer low byte ← "0"
; Stack area starts at 0FFH
Write '01001011B'
; Input clock is f
/256
OSC
; Interval timer mode
; Enable the timer 0 interrupt
; Disable the timer 0 overflow interrupt
; Set timer interval to 4 milliseconds
; (6 MHz/256) ÷ (93 + 1) = 0.25 kHz (4 ms)
; Set register pointer ← 0C0H
; Enable interrupts
BASIC TIMER AND TIMER 0
10-9

Advertisement

Table of Contents
loading

Table of Contents