3-W806-Delay_Us_Ms

void Delay_Us(uint8_t freq,uint32_t time)
{
    uint32_t i;
    uint16_t num = 90;
    switch(freq)
    {
        case 240: num = 80;break;
        case 160: num = 53;break;
        default: printf("delay input freq err...default set 240MHZ us time \r\n ");break;
    }
    
    for (i = 0; i < (num)*time; i++)
    {
        __NOP();
    }
}
void Delay_Ms(uint8_t freq,uint32_t time)
{
    uint32_t i;
    uint16_t num = 90;
    switch(freq)
    {
        case 240: num = 80;break;
        case 160: num = 53;break;
        default: printf("delay input freq err...default set 240MHZ us time \r\n ");break;
    }
    
    for (i = 0; i < (num)*time*1000; i++)
    {
        __NOP();
    }
}

posted on 2023-08-27 01:00  naive156  阅读(0)  评论(0编辑  收藏  举报  来源

导航