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

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

Advertisement

External interrupt INTP1
*****************************************************************************/
__interrupt void fn_intp1(){
unsigned char ucChat;
*/
for (ucChat = g_ucChat[g_ucSWcnt] ; ucChat > 0 ; ucChat--){ /* Wait of
about 10 ms (for removing chattering) */
while (!TMIF000){ /* Wait for the INTTM000 interrupt request */
}
TMIF000 = 0;
flag */
fn_subinttm000(); /* Service the INTTM000 interrupt */
}
PIF1 = 0;
if (!P4.3){
*/
g_ucSWcnt = (g_ucSWcnt + 1) & 0b00000011; /* Update the number of
switch inputs */
TMC00 = 0b00000000;
CR000 = g_unCR000data[g_ucSWcnt];
base time in accordance with the number of switch inputs */
TMC00 = 0b00001100;
start upon a match between TM00 and CR000) */
g_ucTM000cnt = 0; /* Clear the number of INTTM000 interrupts */
}
return;
}
/*****************************************************************************
Interrupt INTTM000
*****************************************************************************/
__interrupt void fn_inttm000(){
fn_subinttm000();
return;
}
/*----------------------------------------------------------------------------
Subroutine for measuring the number of INTTM000 interrupts
----------------------------------------------------------------------------*/
void fn_subinttm000(){
if (++g_ucTM000cnt == 250){
interrupts is 250 */
g_ucTM000cnt = 0; /* Clear the number of INTTM000 interrupts */
P2 ^= 0b00000001; /* Reverse the LED output */
46
APPENDIX A PROGRAM LIST
NOP();
/* Clear the INTP1 interrupt request */
/* Processing performed if SW is on for 10 ms or more
/* Service the INTTM000 interrupt */
Application Note U18887EJ1V0AN
/* 8-bit variable for removing chattering
/* Clear the INTTM000 interrupt request
/* Stop the timer operation */
/* Change the LED blinking
/* Start the timer operation (clear &
/* Processing when the number of INTTM000

Advertisement

Table of Contents
loading

This manual is also suitable for:

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

Table of Contents