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

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

Advertisement

(2) C language
void hdwinit(void){
unsigned char ucCnt200us; /* 8-bit variable for 200 us wait */
Setting the interval
time
CRC00 = 0b00000000;
Setting the count
clock
CR000 = 63-1;
PRM00 = 0b00000010;
TOC00 = 0b00000000;
Disabling timer
TMC00 = 0b00001100;
output
match between TM00 and CR000) */
Starting timer
operation
INTM0 = 0b00000000;
IF0
PMK1
TMMK000 = 0;
return;
}
void main(void){
EI();
while (1){
}
}
Setting the
CR000 register
after stopping
timer operation
with the number of switch inputs */
match between TM00 and CR000) */
interrupt void fn_inttm000(){
fn_subinttm000();
Starting interrupt
servicing by
return;
INTTM000
interrupt
generation
24
CHAPTER 4 SETTING METHODS
= 0x00;
= 0;
Enabling
INTTM000
interrupt
servicing
NOP();
NOP();
TMC00 = 0b00000000; /* Stop the timer operation */
CR000 = g_unCR000data[g_ucSWcnt];
TMC00 = 0b00001100; /* Start the timer operation (clear & start upon a
Starting timer
operation
Application Note U18887EJ1V0AN
Setting the operation mode
of CR000 as a compare
register
/* Use CR000 as a compare register */
/* 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 */
Clearing the
INTTM000
interrupt request
flag
/* Enable vector interrupt */
/* Change the LED blinking base time in accordance
/* Service the INTTM000 interrupt */

Advertisement

Table of Contents
loading

This manual is also suitable for:

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

Table of Contents