示例#1
0
文件: main.c 项目: go2net/kt-rec-pro
/*----------------------------------------------------------------------------*/
void timer0isr(void)
{
    static xd_u8 counter0, counter1;

    PSW = 0x08;
    DPCON = 0x0;
    T0CON &= ~BIT(7);			//clear pending
#ifdef LCD_GPIO_DRV
   seg_lcd_disp_scan();
#else
   //disp_scan();
#endif
    adc_scan();
    counter0++;
    usb_polling();

#ifdef JOG_STICK_FUNC	 
    JogDetect();
#endif

    if ((counter0 % 5) == 0)			//10ms
    {
        dec_delay_counter();
//#if SDMMC_CMD_MODE
//        sd_online_check();
//#if SDMMC_CLK_MODE
        sdmmc_online_chk(1);
//#elif SDMMC_GPIO_MODE
        //sdmmc_detect();
//#endif
        keyScan();
    }

//    if ((counter0 % 50) == 0)
//    {
//        put_msg_fifo(MSG_100MS);
//    }
    if ((counter0 % 100) == 0)
    {
    	 ad_mod_sel_hdlr();
        put_msg_fifo(MSG_200MS);
        counter0 = 0;
    }
    counter1++;
    if ((counter1 % 250) == 0)
    {
        put_msg_fifo(MSG_HALF_SECOND);
        counter1 = 0;
    }
#if 0//RTC_ENABLE
    if (IRTCON & BIT(7))
    {
        alm_cnt = 1;
        last_work_mode = work_mode;
        put_msg_lifo(MSG_ALM_ON);
    }
#endif
}
示例#2
0
文件: main.c 项目: go2net/my-com-rec
/*----------------------------------------------------------------------------*/
void timer0isr(void)
{
    static u8 counter0, counter1;

    PSW = 0x08;
    DPCON = 0x0;
    T0CON &= ~BIT(7);			//clear pending

#ifndef NO_LED_DISPLAY
    disp_scan();
#endif    
    adc_scan();
    counter0++;
    usb_polling();

   disp_dled();

    if ((counter0 % 5) == 0)			//10ms
    {
        dec_delay_counter();
//#if SDMMC_CMD_MODE
//        sd_online_check();
#if SDMMC_CLK_MODE
        sdmmc_online_chk(1);
#elif SDMMC_GPIO_MODE
        sdmmc_detect();
#endif
        keyScan();
    }

//    if ((counter0 % 50) == 0)
//    {
//        put_msg_fifo(MSG_100MS);
//    }
    if ((counter0 % 100) == 0)
    {

	 //aux_check();
        //put_msg_fifo(MSG_200MS);
        counter0 = 0;
    }
    counter1++;
    if ((counter1 % 250) == 0)
    {
        put_msg_fifo(MSG_HALF_SECOND);
        counter1 = 0;
    }
#if RTC_ENABLE
    if (IRTCON & BIT(7))
    {
        alm_cnt = 1;
        last_work_mode = work_mode;
        put_msg_lifo(MSG_ALM_ON);
    }
#endif
}
示例#3
0
void main() {
  sysclk_init(); // Initialize oscillator
  wait_ms(1000);
  port_init(); // Initialize crossbar and GPIO

  gpib_init();

  timer_init();
  
  EA = 1; // Global Interrupt enable

  usb0_init();

  while (1) {
    gpib_polling();
    usb_polling();

    if(sys_state & SYS_PERIODIC_ACTIVE){
      sys_state &= ~SYS_PERIODIC_ACTIVE;
      led_toggle(1);
    }

    if(sys_state & SYS_GPIB_CONTROLLER){
      led_on(2);
    }else{
      led_off(2);
    }

    { // check talked
      static __xdata u8 persistent = 0;
      if(sys_state & SYS_GPIB_TALKED){
        led_on(3);
        persistent = 0x40;
      }else if(persistent > 0){
        led_toggle(3);
        persistent--;
      }else{
        led_off(3);
      }
    }

    { // check listened
      static __xdata u8 persistent = 0;
      if(sys_state & SYS_GPIB_LISTENED){
        led_on(4);
        persistent = 0x40;
      }else if(persistent > 0){
        led_toggle(4);
        persistent--;
      }else{
        led_off(4);
      }
    }
  }
}