⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interrpte.c

📁 瑞萨单片机LCD控制
💻 C
📖 第 1 页 / 共 3 页
字号:
/*       Date/Author  :      10.04.1997/GA                                */
/*       Parameter    :                                                   */
/*       Return       :                                                   */
/*                                                                        */
/**************************************************************************/
/* Interrupt with using the register bank switch */
interrupt [52] using [ALTERNATE_SET] void near key_input_interrupt (void)
/* Interrupt without using the register bank switch */
//interrupt [52] void near key_input_interrupt (void)
{     
  /* Add code here */
}

/**************************************************************************/
/*                                                                        */
/*       A-D interrupt routine                                            */
/*       Name         :      a_d_interrupt                                */
/*       Date/Author  :      10.04.1997/GA                                */
/*       Parameter    :                                                   */
/*       Return       :                                                   */
/*                                                                        */
/**************************************************************************/
/* Interrupt with using the register bank switch */
interrupt [56] using [ALTERNATE_SET] void near a_d_interrupt (void)
/* Interrupt without using the register bank switch */
//interrupt [56] void near a_d_interrupt (void)
{     
  /* Add code here */
}

/**************************************************************************/
/*                                                                        */
/*       UART0Tx interrupt routine                                        */
/*       Name         :      uart0tx_interrupt                            */
/*       Date/Author  :      10.04.1997/GA                                */
/*       Parameter    :                                                   */
/*       Return       :                                                   */
/*                                                                        */
/**************************************************************************/
/* Interrupt with using the register bank switch */  
interrupt using [ALTERNATE_SET] void near uart0tx_interrupt (void) 
//interrupt [68] using [ALTERNATE_SET] void near uart0tx_interrupt (void)
/* Interrupt without using the register bank switch */
//interrupt [68] void near uart0tx_interrupt (void)
{    
  /* Add code here */
#ifdef SAMPLE_Y3 
  SEND_STRING[k] = DATA_STRING[k];
  uart_0_put_synchronous_mode (SEND_STRING[k]);
  k++;
#endif /* SAMPLE_Y3 */
#ifdef SAMPLE_Y6
  SEND_STRING[k] = DATA_STRING[k];
  uart_0_put_uart_mode (SEND_STRING[k]);
  k++;
#endif /* SAMPLE_Y6 */
}

/**************************************************************************/
/*                                                                        */
/*       UART0Rx interrupt routine                                        */
/*       Name         :      uart0rx_interrupt                            */
/*       Date/Author  :      10.04.1997/GA                                */
/*       Parameter    :                                                   */
/*       Return       :                                                   */
/*                                                                        */
/**************************************************************************/
/* Interrupt with using the register bank switch */
interrupt [72] using [ALTERNATE_SET] void near uart0rx_interrupt (void)
/* Interrupt without using the register bank switch */
//interrupt [72] void near uart0rx_interrupt (void)
{ 
  /* Add code here */
}

/**************************************************************************/
/*                                                                        */
/*       UART1Tx interrupt routine                                        */
/*       Name         :      uart1tx_interrupt                            */
/*       Date/Author  :      10.04.1997/GA                                */
/*       Parameter    :                                                   */
/*       Return       :                                                   */
/*                                                                        */
/**************************************************************************/
// Interrupt with using the register bank switch        
//interrupt [76] using [ALTERNATE_SET] void near uart1tx_interrupt (void) 
// Interrupt without using the register bank switch 
// interrupt [76] void near uart1tx_interrupt (void)
//{                                      
// Add code here                              
//}                                         

/**************************************************************************/
/*                                                                        */
/*       UART1Rx interrupt routine                                        */
/*       Name         :      uart1rx_interrupt                            */
/*       Date/Author  :      10.04.1997/GA                                */
/*       Parameter    :                                                   */
/*       Return       :                                                   */
/*                                                                        */
/**************************************************************************/
// Interrupt with using the register bank switch               
//interrupt [80] using [ALTERNATE_SET] void near uart1rx_interrupt (void) 
// Interrupt without using the register bank switch             
// interrupt [80] void near uart1rx_interrupt (void)          
//{                                     
// Add code here                             
//#if defined (SAMPLE_Y2) || defined (SAMPLE_Y3)  
//help2 = uart_1_get_synchronous_mode ();             
//REC_STRING[j] = help2;                         
//j++;                                       
//#endif /* SAMPLE_Y2, SAMPLE_Y3                
//#if defined (SAMPLE_Y5) || defined (SAMPLE_Y6)    
//help2 = uart_1_get_synchronous_mode ();            
//REC_STRING[j] = help2;                          
//j++;                                       
//#endif /* SAMPLE_Y5, SAMPLE_Y6                 
//}                                       
 
/**************************************************************************/
/*                                                                        */
/*       Timer A0 - interrupt routine                                     */
/*       routine must be adapted to the user's needs                      */
/*                                                                        */
/*       Name         :      timer_a0_interrupt                           */
/*       Date/Author  :      14.04.1997/ST                                */
/*       Parameter    :                                                   */
/*       Return       :                                                   */
/*                                                                        */
/**************************************************************************/
/* Interrupt with using the register bank switch */   
interrupt using [ALTERNATE_SET] void near timer_a0_interrupt (void) 
//interrupt [ 84] using [ALTERNATE_SET] void near timer_a0_interrupt (void)
/* Interrupt without using the register bank switch */
// interrupt [ 84] void near timer_a0_interrupt (void)
{
   timer_100ms++;
}

/**************************************************************************/
/*                                                                        */
/*       timer A1:  interrupt routine                                     */
/*       routine must be adapted to the user's needs                      */
/*                                                                        */
/*       Name         :      timer_a1_interrupt                           */
/*       Date/Author  :      14.04.1997/ST                                */
/*       Parameter    :                                                   */
/*       Return       :                                                   */
/*                                                                        */
/**************************************************************************/
/* Interrupt with using the register bank switch */  
interrupt using [ALTERNATE_SET] void near timer_a1_interrupt (void) 
//interrupt [ 88] using [ALTERNATE_SET] void near timer_a1_interrupt (void)
/* Interrupt without using the register bank switch */
// interrupt [ 88] void near timer_a1_interrupt (void)
{    
//    P4=0x02;
    switch(state_common)
    {
        case STATE_COMMON_C0_ON:
            P0  = 0x01; /* set this common line to high */
            PD0 = 0x01; /* set one common line to output, all others to input */
	    PD1= 0;
	    PD2 = 0;
	    PD3 = 0;
	    PD4 = 0;
            P1  = ~port_1_c0; /* set outputs inverse to common line */
            P2  = ~port_2_c0;            
            P3  = ~port_3_c0;
            P4  = ~port_5_c0;
	    PD1  = 0xff; /* set outputs inverse to common line */
            PD2  = 0xff;            
            PD3  = 0xff;
            PD4  = 0xff;
	    
            state_common = STATE_COMMON_C0_OFF;
            break;
        case STATE_COMMON_C0_OFF:
            P0  = 0x00; /* set this common line low */
            PD0 = 0x01;
	    PD1= 0;
	    PD2 = 0;
	    PD3 = 0;
	    PD4 = 0;

            P1  = port_1_c0; /* set outputs inverse to common line */
            P2  = port_2_c0;
            P3  = port_3_c0;
            P4  = port_5_c0; 
            PD1  = 0xff; /* set outputs inverse to common line */
            PD2  = 0xff;
            PD3  = 0xff;
            PD4  = 0xff; 
            state_common = STATE_COMMON_C1_ON;
            break;
        case STATE_COMMON_C1_ON:

            P0  = 0x02; /* set this common line to high */
            PD0 = 0x02;
	    PD1= 0;
	    PD2 = 0;
	    PD3 = 0;
	    PD4 = 0;
            P1  = ~port_1_c1; /* set outputs inverse to common line */
            P2  = ~port_2_c1;
            P3  = ~port_3_c1;
            P4  = ~port_5_c1;            
	    PD1= 0xff;
	    PD2 = 0xff;
	    PD3 = 0xff;
	    PD4 = 0xff;

            state_common = STATE_COMMON_C1_OFF;
            break;
        case STATE_COMMON_C1_OFF:

            P0  = 0x00; /* set this common line low */
            PD0 = 0x02;
	    PD1= 0;
	    PD2 = 0;
	    PD3 = 0;
	    PD4 = 0;
            P1  = port_1_c1; /* set outputs inverse to common line */
            P2  = port_2_c1;
            P3  = port_3_c1;
            P4  = port_5_c1;
	    PD1= 0xff;
	    PD2 = 0xff;
	    PD3 = 0xff;
	    PD4 = 0xff;

            state_common = STATE_COMMON_C2_ON;
            break;
        case STATE_COMMON_C2_ON:

            P0  = 0x04; /* set this common line to high */
            PD0 = 0x04;
	    PD1= 0;
	    PD2 = 0;
	    PD3 = 0;
	    PD4 = 0;
            P1  = ~port_1_c2; /* set outputs inverse to common line */
            P2  = ~port_2_c2;
            P3  = ~port_3_c2;
            P4  = ~port_5_c2;            
	    PD1= 0xff;
	    PD2 = 0xff;
	    PD3 = 0xff;
	    PD4 = 0xff;

            state_common = STATE_COMMON_C2_OFF;
            break;
        case STATE_COMMON_C2_OFF:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -