我尝试用CH582的tim0做查询方式的延时,但是设置后似乎不生效,请教下该如何解决。
void mdelay100ms() { R8_TMR0_CTRL_MOD &= RB_TMR_ALL_CLEAR; R32_TMR0_CNT_END = (FREQ_SYS / 10); R8_TMR0_CTRL_MOD |= RB_TMR_COUNT_EN; do { printf("count:0x%08x\n",R32_TMR0_COUNT); printf("cnt:0x%08x\n",R32_TMR0_CNT_END); } while (R32_TMR0_COUNT == (FREQ_SYS / 10)); R8_TMR0_CTRL_MOD &= ~RB_TMR_COUNT_EN; } int main() { SetSysClock(CLK_SOURCE_PLL_60MHz); DebugInit(); mdelay100ms(); while (1) { } }
串口的显示
热门产品 :
CH32X035: 32位USB+USB PD单片机