static void R_MAIN_UserInit(void) { /* Start user code. Do not edit comment generated here */ EI(); R_TAU0_Channel0_Start(); R_ADC_Set_OperationOn(); /* End user code. Do not edit comment generated here */ }
/*********************************************************************************************************************** Global variables and functions ***********************************************************************************************************************/ /* Start user code for global. Do not edit comment generated here */ unsigned short int ADC_buffer; /* End user code. Do not edit comment generated here */ /*********************************************************************************************************************** * Function Name: r_tau0_channel0_interrupt * Description : This function INTTM00 interrupt service routine. * Arguments : None * Return Value : None ***********************************************************************************************************************/ void r_tau0_channel0_interrupt(void) { /* Start user code. Do not edit comment generated here */ ADCS = 0; if(P0_bit.no0 ==0){ ADS = 0; } else if(P0_bit.no0 ==1){ ADS = 1; } R_ADC_Start(); if(ADCS == 1){ ; } R_ADC_Get_Result(&ADC_buffer); ADC_buffer = ADC_buffer*20; //注1 if(ADC_buffer>21000) ADC_buffer=21000; //注2 if(ADC_buffer<0) ADC_buffer=0; EI(); TDR01H = ADC_buffer>>8; TDR01L = ADC_buffer & 0x0F; DI(); /* End user code. Do not edit comment generated here */ }
Copyright © 面白半分