我嘗試用CH582的tim0做查詢(xún)方式的延時(shí),但是設(shè)置后似乎不生效,請(qǐng)教下該如何解決。
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) ??{ ??} }
串口的顯示
熱門(mén)產(chǎn)品 :
CH592: RISC-V內(nèi)核BLE5.4無(wú)線(xiàn)MCU