Intel UPI- 41A User Manual page 54

Microprocessor peripherals
Table of Contents

Advertisement

UPI-41A 41AH 42 42AH USER'S MANUAL
STOP TCNT Stop Timer Event Counter
Opcode
0 1 1 0
This instruction is used to stop both time accumulation and event counting
Example
Disable interrupt but jump to interrupt routine after eight overflows and stop timer Count
overflows in register 7
START DIS TCNTI
MAIN
COUNT INC R7
INT STOP TCNT
STRT CNT Start Event Counter
Opcode
0 1 0 0
The TEST 1 (T
event-counter register is incremented with each high to low transition on the T
Example
Initialize and start event counter Assume overflow is desired with first T
STARTC EN TCNTI
STRT T Start Timer
Opcode
0 1 0 1
Timer accumulation is initiated in the timer register The register is incremented every 32
instruction cycles The prescaler which counts the 32 cycles is cleared but the timer register is
not
Example
Initialize and start timer
STARTT EN TCNTI
50
0 1 0 1
CLR A
MOV T A
MOV R7 A
STRT T
JTF COUNT
JMP MAIN
MOV A R7
JB3 INT
JMP MAIN
JMP 7H
0 1 0 1
) pin is enabled as the event-counter input and the counter is started The
1
MOV A
OFFH
MOV T A
STRT CNT
0 1 0 1
CLR A
MOV T A
STRT T
DISABLE TIMER INTERRUPT
CLEAR ACC TO ZERO
MOV ZERO TO TIMER
MOVE ZERO TO REG 7
START TIMER
JUMP TO ROUTINE 'COUNT'
IF TF
1 AND CLEAR TIMER FLAG
e
CLOSE LOOP
INCREMENT REG 7
MOVE REG 7 CONTENTS TO ACC
JUMP TO ROUTINE 'INT' IF ACC
BIT 3 IS SET (REG 7
8)
e
OTHERWISE RETURN TO ROUTINE
MAIN
STOP TIMER
JUMP TO LOCATION 7 (TIMER
INTERRUPT ROUTINE)
ENABLE COUNTER INTERRUPT
MOVE 'FF' HEX (ONES) TO
ACC
MOVE ONES TO COUNTER
INPUT AND START
ENABLE TIMER INTERRUPT
CLEAR ACC TO ZEROS
MOVE ZEROS TO TIMER
START TIMER
pin
1
input
1

Advertisement

Table of Contents
loading

Table of Contents