/***********************************************************************/ /* */ /* FILE :resetprg.c */ /* DATE :Thu, Dec 24, 2009 */ /* DESCRIPTION :Reset Program */ /* CPU TYPE :H8S/20103 */ /* */ /* This file is generated by Renesas Project Generator (Ver.4.16). */ /* */ /***********************************************************************/ #include #include <_h_c_lib.h> //#include // Remove the comment when you use errno //#include // Remove the comment when you use rand() #include "typedefine.h" #include "stacksct.h" #include "iodefine.h" extern void main(void); __entry(vect=0) void PowerON_Reset(void); //__interrupt(vect=1) void Manual_Reset(void); //#ifdef __cplusplus // Enable I/O in the application(both SIM I/O and hardware I/O) //extern "C" { //#endif //extern void _INIT_IOLIB(void); //extern void _CLOSEALL(void); //#ifdef __cplusplus //} //#endif //extern void srand(_UINT); // Remove the comment when you use rand() //extern _SBYTE *_s1ptr; // Remove the comment when you use strtok() //#ifdef __cplusplus // Remove the comment when you use Hardware Setup //extern "C" { //#endif //extern void HardwareSetup(void); //#ifdef __cplusplus //} //#endif //#ifdef __cplusplus // Remove the comment when you use global class object //extern "C" { // Sections C$INIT and C$END will be generated //#endif //extern void _CALL_INIT(void); //extern void _CALL_END(void); //#ifdef __cplusplus //} //#endif #pragma section ResetPRG __entry(vect=0) void PowerON_Reset(void) { set_imask_ccr((_UBYTE)1); // WDT停止処理 MSTCR1.BIT.MSTWDT = 0; // MSTWDT:0 WDT.TCSRWD.BYTE = 0x97; // WE TMWLOCK/TMWI WDT.TCSRWD.BYTE = 0xa3; // WE TMWD WDT.TMWD.BYTE = 0xf7; // Clock入力禁止 WDT.TMWD.BYTE = 0xf8; // WDT停止 WDT.TCSRWD.BYTE = 0x87; // WD TMWLOCK/TMWI // 低速OCO->メイン発振器に切替え CPG.OSCCSR.BYTE = 0xe; // 20MHz(262144)6.5ms以上 PMRJ.BYTE = 0x3; // OSC2 OSC1 CPG.SYSCCR.BYTE = (CPG.SYSCCR.BYTE & 0x7f) | 0x40; // WI:0 WE:1 CPG.SYSCCR.BYTE = 0x60; // PHIHSEL:1 CPG.SYSCCR.BYTE = CPG.SYSCCR.BYTE & 0x3f; // WI:0 WE:0 CPG.LPCR1.BYTE = (CPG.LPCR1.BYTE & 0x7f) | 0x40; // WI:0 WE:1 CPG.LPCR1.BYTE = 0x41; // PHIBSEL:1 CPG.LPCR1.BYTE = CPG.LPCR1.BYTE & 0x3f; // WI:0 WE:0 CPG.LPCR2.BYTE = (CPG.LPCR2.BYTE & 0x7f) | 0x40; // WI:0 WE:1 CPG.LPCR2.BYTE = 0x40; // φbase CPG.LPCR2.BYTE = CPG.LPCR2.BYTE & 0x3f; // WI:0 WE:0 CPG.LPCR3.BYTE = (CPG.LPCR3.BYTE & 0x7f) | 0x40; // WI:0 WE:1 CPG.LPCR3.BYTE = 0x40; // BusMaster φs CPG.LPCR3.BYTE = CPG.LPCR3.BYTE & 0x3f; // WI:0 WE:0 _INITSCT(); // _CALL_INIT(); // Remove the comment when you use global class object // _INIT_IOLIB(); // Enable I/O in the application(both SIM I/O and hardware I/O) // errno=0; // Remove the comment when you use errno // srand((_UINT)1); // Remove the comment when you use rand() // _s1ptr=NULL; // Remove the comment when you use strtok() // HardwareSetup(); // Remove the comment when you use Hardware Setup // set_imask_ccr((_UBYTE)0); main(); // _CLOSEALL(); // Close I/O in the application(both SIM I/O andhardware I/O) // _CALL_END(); // Remove the comment when you use global class object sleep(); } //__interrupt(vect=1) void Manual_Reset(void) // Remove the comment when you use Manual Reset //{ //}