NEC 78K0S/K 1+ Series Application Note page 23

Sample program (16-bit timer/event counter 00) interval timer
Hide thumbs Also See for 78K0S/K 1+ Series:
Table of Contents

Advertisement

[Excerpt from this sample program source]
An excerpt from
shown below (same contents as in
(1) Assembly language
XMAIN CSEG
RESET_START:
Setting the interval
time
MOV
MOVW
to the AX register
Setting the count
MOVW
clock
MOV
MOV
Disabling timer
output
MOV
match between TM00 and CR000)
Starting timer
operation
MOV
MOV
Clearing the
CLR1
INTTM000
CLR1
interrupt request
flag
EI
MAIN_LOOP:
NOP
BR
MOV
MOV
Setting the
ADD
CR000 register
AND
after stopping
MOV
timer operation
MOV
the table
MOV
MOV
the table
MOVW
Starting timer
operation
MOV
match between TM00 and CR000)
INTERRUPT_TM000:
CALL
Starting
RETI
interrupt servicing
by INTTM000
interrupt
generation
CHAPTER 4 SETTING METHODS
APPENDIX A PROGRAM
[Example
UNIT
CRC00, #00000000B
AX,
#63-1
CR000, AX
PRM00, #00000010B
TOC00, #00000000B
TMC00, #00001100B
INTM0, #00000000B
IF0,
#00H
PMK1
TMMK000
Enabling
INTTM000
interrupt
servicing
$MAIN_LOOP
TMC00, #00000000B
A,
L
A,
#2
A,
#00000111B
L,
A
A,
[HL]
X,
A
A,
[HL+1]
CR000, AX
TMC00, #00001100B
!SUB_INTERRUPT_TM000; INTTM000 subroutine call
Application Note U18887EJ1V0AN
LIST, which is related to the 16-bit timer/event counter 00 function, is
1] mentioned above).
Setting the operation
mode of CR000 as a
compare register
; Use CR000 as a compare register
; Assign the LED blinking base time initial value
; Initialize the LED blinking base time
; Count clock = fxp/2^8 = 31.25 kHz
; Do not perform timer output
; Start the timer operation (clear & start upon a
; Set the valid edge of INTP1 to falling edge
; Clear invalid interrupt requests in advance
; Unmask INTP1 interrupts
; Unmask INTTM000 interrupts
; Enable vector interrupt
; Go to the MAIN_LOOP
; Stop the timer operation
; Read the lower 8 bits of the table address
; Increment the table address by 2
; Mask bits other than bits 0 to 2
; Write to the lower 8 bits of the table address
; Read the lower 8 bits of the compare value from
; Read the higher 8 bits of the compare value from
; Change the LED blinking base time
; Start the timer operation (clear & start upon a
; Return from interrupt servicing
23

Advertisement

Table of Contents
loading

This manual is also suitable for:

78k0s/ka1+78k0s/kb1+78k0s/ku1+78k0s/ky1+

Table of Contents