main.c
#include "r_cg_macrodriver.h"
#include "r_cg_cgc.h"
#include "r_cg_port.h"
#include "r_cg_timer.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
/* Start user code for global. Do not edit comment generated here */
unsigned char cout=0;
unsigned char led[16]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
void R_MAIN_UserInit(void);
void Delay()//计时函数,每1s计数
{
cout++;
if(cout>=16)
cout=0;
}
/* End user code. Do not edit comment generated here */
void R_MAIN_UserInit(void);
/***********************************************************************************************************************
* Function Name: main
* Description : This function implements main function.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void main(void)
{
R_MAIN_UserInit();
/* Start user code. Do not edit comment generated here */
R_TAU0_Channel0_Start();
P0.0=0;
P0.1=1;
P0.2=1;
P0.3=1;
P0.4=0;//打开38译相关
while (1U)
{
P1=led[cout];//注意是从高到底
}
/* End user code. Do not edit comment generated here */
}
/***********************************************************************************************************************
* Function Name: R_MAIN_UserInit
* Description : This function adds user code before implementing main function.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_MAIN_UserInit(void)
{
/* Start user code. Do not edit comment generated here */
EI();
/* End user code. Do not edit comment generated here */
}
timeuser.c相关
/***********************************************************************************************************************
* Function Name: r_tau0_channel0_interrupt
* Description : This function is INTTM00 interrupt service routine.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
__interrupt static void r_tau0_channel0_interrupt(void)
{
/* Start user code. Do not edit comment generated here */
Delay();
/* End user code. Do not edit comment generated here */
}