__interrupt static void r_tau0_channel0_interrupt(void)
{
if (1U == (TSR00 & _01_TAU_OVERFLOW_OCCURS)) /* overflow occurs */
{
g_tau0_ch0_width = (uint32_t)TDR00L;
g_tau0_ch0_width = (uint32_t)TDR00H * 0xFFU + g_tau0_ch0_width + 0x10000U;
}
else
{
g_tau0_ch0_width = (uint32_t)TDR00L;
g_tau0_ch0_width = (uint32_t)TDR00H * 0xFFU + g_tau0_ch0_width;
}
AsciiConvert((uint32_t)g_tau0_ch0_width); //调用LCD显示的数据转换函数
}
//定时器配置
void R_TAU0_Create(void)
{
TAU0EN = 1U; /* supplies input clock */
TPS0 = _02_TAU_CKM0_FCLK_2 | _00_TAU_CKM1_FCLK_0;
/* Stop all channels */
TTH0 =_02_TAU_CH1_H8_STOP_TRG_ON;
TT0 = _01_TAU_CH0_STOP_TRG_ON | _02_TAU_CH1_STOP_TRG_ON;
/* Mask channel 0 interrupt */
TMMK00 = 1U; /* disable INTTM00 interrupt */
TMIF00 = 0U; /* clear INTTM00 interrupt flag */
/* Mask channel 1 interrupt */
TMMK01 = 1U; /* disable INTTM01 interrupt */
TMIF01 = 0U; /* clear INTTM01 interrupt flag */
/* Mask channel 1 higher 8 bits interrupt */
TMMK01H = 1U; /* disable INTTM01H interrupt */
TMIF01H = 0U; /* clear INTTM01H interrupt flag */
/* Set INTTM00 low priority */
TMPR100 = 1U;
TMPR000 = 1U;
}
//IO配置
void R_PORT_Create(void)
{
P0 = _01_Pn0_OUTPUT_1 | _02_Pn1_OUTPUT_1 | _04_Pn2_OUTPUT_1 | _08_Pn3_OUTPUT_1 | _10_Pn4_OUTPUT_1;
P4 = _01_Pn0_OUTPUT_1;
PMC0 = _00_PMCn1_DI_ON | _00_PMCn2_DI_ON | _00_PMCn3_DI_ON | _00_PMCn4_DI_ON | _E1_PMC0_DEFAULT;
PM0 = _00_PMn0_MODE_OUTPUT | _00_PMn1_MODE_OUTPUT | _00_PMn2_MODE_OUTPUT | _00_PMn3_MODE_OUTPUT |
_00_PMn4_MODE_OUTPUT | _E0_PM0_DEFAULT;
PM4 = _00_PMn0_MODE_OUTPUT | _FE_PM4_DEFAULT;
}