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

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

Advertisement

----------------------------------------------------------------------------*/
P4
= 0b00000000;
PU4
= 0b00001000;
*/
PM4
= 0b00001000;
P43 as input mode */
/*----------------------------------------------------------------------------
Initialize the port 12
----------------------------------------------------------------------------*/
P12
= 0b00000000;
*/
PM12
= 0b11110000;
/*----------------------------------------------------------------------------
Initialize the port 13
----------------------------------------------------------------------------*/
P13
= 0b00000001;
/*----------------------------------------------------------------------------
Set 16-bit timer 00
----------------------------------------------------------------------------*/
CRC00 = 0b00000000;
CR000 = 63-1;
*/
PRM00 = 0b00000010;
TOC00 = 0b00000000;
TMC00 = 0b00001100;
start upon a match between TM00 and CR000) */
/*----------------------------------------------------------------------------
Set the interrupt
----------------------------------------------------------------------------*/
INTM0 = 0b00000000;
edge */
IF0
= 0x00;
advance */
PMK1
= 0;
TMMK000 = 0;
return;
}
/*****************************************************************************
Main loop
*****************************************************************************/
void main(void){
EI();
while (1){
NOP();
NOP();
}
}
/*****************************************************************************
APPENDIX A PROGRAM LIST
/* Set output latches of P40-P47 as low */
/* Connect on-chip pull-up resistor to P43
/* Set P40-P42 and P44-P47 as output mode,
/* Set output latches of P120-P123 as low
/* Set P120-P123 as output mode */
/* Set output latch of P130 as high */
/* 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 &
/* Set the valid edge of INTP1 to falling
/* Clear invalid interrupt requests in
/* Unmask INTP1 interrupts */
/* Unmask INTTM000 interrupts */
/* Enable vector interrupt */
Application Note U18887EJ1V0AN
45

Advertisement

Table of Contents
loading

This manual is also suitable for:

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

Table of Contents