此段程序是华大MCU 把GPIO 设置为FAST IO 输出(此方式输出翻转需要一个HCLK 周期),当HCLK=4MHZ 时,GPIO 输出波形频率为2MHZ ,我用示波器测试的波形评率是1MHZ ,请问是哪里出现了问题?
int32_t main(void)
{
uint32_t u32High = 0x00004000; ///< PD14
uint32_t u32Low = 0x00000000;
///< LED端口初始化
App_LedInit();
while(1)
{
///< LED 翻转输出2MHZ(当HCLK = RCH4MHz)
LED_TOGGLE8();
LED_TOGGLE8();
LED_TOGGLE8();
LED_TOGGLE8();
LED_TOGGLE8();
LED_TOGGLE8();
LED_TOGGLE8();
LED_TOGGLE8();
}
}
#define LED_TOGGLE8() {M0P_GPIO->PDOUT = u32High;\
M0P_GPIO->PDOUT = u32Low;\
M0P_GPIO->PDOUT = u32High;\
M0P_GPIO->PDOUT = u32Low;\
M0P_GPIO->PDOUT = u32High;\
M0P_GPIO->PDOUT = u32Low;\
M0P_GPIO->PDOUT = u32High;\
M0P_GPIO->PDOUT = u32Low;}
|