#include #include "kernel_cfg.h" #include // Include machine.h #include "iodefine.h" // Include iodefine.h #include //#include "typedefine.h" #ifdef __cplusplus //#include // Remove the comment when you use ios //_SINT ios_base::Init::init_cnt; // Remove the comment when you use ios #endif void main(intptr_t arg); #ifdef __cplusplus extern "C" { void abort(void); } #endif void main(intptr_t arg) { printf("hello@main\n"); PORT1.DDR.BIT.B5 = 1; // P15 is Output MSTP( CMT0 ) = 0; // Wakeup CMT0,CMT1 CMT0.CMCOR = 4800000/512/2 - 1; // CMCOR is 500ms Count CMT0.CMCR.WORD = 0x0043; // CMIE is Enable,CKS is PCLK/512 IEN( CMT0, CMI0 ) = 1; // CMI0 Enable IPR( CMT0, CMI0 ) = 1; // CMI0 Interrupt Level is 1 // set_psw( 0x00010000 ); // Set I=1, IPL=0 of PSW CMT.CMSTR0.BIT.STR0 = 1; // Start CMT0 // for(;;) // ; } void task2(intptr_t arg) { printf("task2\n"); } void CMI0(void) // Interrupt Function { // Multiple Interrupt Enable PORT1.DR.BIT.B5 ^= 1; // Reverse P15(LED) iact_tsk(TASK2_ID); } #ifdef __cplusplus void abort(void) { } #endif