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

Led lighting switch control sample program (initial settings)
Hide thumbs Also See for 78K0S/K 1+ Series:
Table of Contents

Advertisement

/*****************************************************************************
Initialization after RESET
*****************************************************************************/
void hdwinit(void){
/*----------------------------------------------------------------------------
Initialize the watchdog timer
----------------------------------------------------------------------------*/
WDTM
= 0b01110111;
/*----------------------------------------------------------------------------
Initialize the clock generators
----------------------------------------------------------------------------*/
PPCC
= 0b00000010;
PCC
= 0b00000000;
LSRCM = 0b00000001;
/*----------------------------------------------------------------------------
Initialize the port 0
----------------------------------------------------------------------------*/
PM0
= 0b11110000;
P0
= 0b00000000;
/*----------------------------------------------------------------------------
Initialize the port 2
----------------------------------------------------------------------------*/
PM2
= 0b11110000;
P2
= 0b00000111;
/*----------------------------------------------------------------------------
Initialize the port 3
----------------------------------------------------------------------------*/
PM3
= 0b11110000;
P3
= 0b00000000;
/*----------------------------------------------------------------------------
Initialize the port 4
----------------------------------------------------------------------------*/
PM4
= 0b00001001;
PU4
= 0b00001001;
P4
= 0b00000000;
/*----------------------------------------------------------------------------
Initialize the port 12
----------------------------------------------------------------------------*/
PM12
= 0b11110000;
P12
= 0b00000000;
/*----------------------------------------------------------------------------
Initialize the port 13
APPENDIX A PROGRAM LIST
/* Stop the watchdog timer operation */
/* The clock supplied to the peripheral */
/* hardware (fxp) = fx/4 (= 2MHz) */
/* The clock supplied to the CPU (fcpu) = */
/* fxp (= 2MHz) */
/* Stop the low-speed internal oscillator */
/* Set P00-P03 as output mode */
/* Set output latches of P00-P03 as low */
/* Set P20-P23 as output mode */
/* Set output latches of P20-P22 as high, */
/* P23 as low */
/* Set P30-P33 as output mode */
/* Set output latches of P30-P33 as low */
/* Set P40 and P43 as input mode, P41, */
/* P42 and P44-P47 as output mode */
/* Connect on-chip pull-up resistors to */
/* P40 and P43 */
/* Set output latches of P41, P42 and */
/* P44-P47 as low */
/* Set P120-P123 as output mode */
/* Set output latches of P120-P123 as */
/* low */
Application Note U18752EJ2V0AN
41

Advertisement

Table of Contents
loading

This manual is also suitable for:

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

Table of Contents