www.pudn.com > S12G_Bootloader_Host_App.zip > main.c, change:2011-08-03,size:852b


#include <hidef.h>      /* common defines and macros */ 
#include "derivative.h"      /* derivative-specific definitions */ 
 
 
byte cnt; 
#define TIME 50 
 
 
 
void main(void){ 
 
  IVBR = 0xEF;                     
   
  _DISABLE_COP(); 
 
  PTT = 0xf0;               
  DDRT = 0xF0; 
 
   // rti, IRC1M as clk, 8ms interrupt 
   CPMURTI = 0x93;     // 1MHz * 8x10^3 = 8ms 
   CPMUINT_RTIE = 1; 
   cnt=0; 
    
	EnableInterrupts; 
 
  for(;;) { 
     
  } /* loop forever */ 
   
} 
 
#pragma CODE_SEG __NEAR_SEG NON_BANKED  
 
//void interrupt VectorNumber_Vrti isr_rti(void){ 
void interrupt isr_rti(void){ 
    CPMUFLG_RTIF = 1;       // clr the flag of rti 
    cnt++; 
    if((cnt%TIME)==0){ 
      PTT += 0x10; 
      cnt=0; 
    } 
} 
 
 
#pragma CODE_SEG APP_ROM_ENTRY 
void app_entry(void){ 
    _Startup();   
} 
#pragma CODE_SEG DEFAULT