杰理-AC701-watch-手表-数字显示

杰理-AC701-watch-手表-数字显示

超5位数用TYPE_STRING类型
杰理-AC701-watch-手表-数字显示_第1张图片杰理-AC701-watch-手表-数字显示_第2张图片




TYPE_STRING类型

杰理-AC701-watch-手表-数字显示_第3张图片

杰理-AC701-watch-手表-数字显示_第4张图片
杰理-AC701-watch-手表-数字显示_第5张图片

 void num_to_string_6(u32 num, u8 *buf)
{
    u8 len = 0;
    if ((num >= 100000) && (num <= 999999)) {
        G_log("2022/07/20----------------------------111111111111111111111111111111--------------------------------");
        buf[len++] = '0' + num  / 100000;
        buf[len++] = '0' + (num / 10000) % 10;
        buf[len++] = '0' + (num / 1000) % 10;
        buf[len++] = '0' + (num / 100) % 10;
        buf[len++] = '0' + (num / 10) % 10;
    } else if ((num >= 10000) && (num <= 99999)) {
        G_log("2022/07/20--------------------------------------------2------------------------------");
        buf[len++] = '0' + num  / 10000;
        buf[len++] = '0' + (num / 1000) % 10;
        buf[len++] = '0' + (num / 100) % 10;
        buf[len++] = '0' + (num / 10) % 10;
    } else if ((num >= 1000) && (num <= 9999)) {
        G_log("2022/07/20--------------------------------------------3------------------------------");
        buf[len++] = '0' + num / 1000;
        buf[len++] = '0' + (num / 100) % 10;
        buf[len++] = '0' + (num / 10) % 10;
    } else if ((num >= 100) && (num <= 999)) {
        G_log("2022/07/20-------------------------------------------4------------------------------");
        buf[len++] = '0' + num / 100;
        buf[len++] = '0' + (num / 10) % 10;
        
    } else if (num < 10) {

    } else {
        G_log("2022/07/20--------------------------------------------5------------------------------");
        buf[len++] = '0' + num / 10;
    }
    G_log("2022/07/20--------------------------------------------6------------------------------");
    buf[len++] = '0' + num % 10;
    buf[len++] = ' ';
    buf[len++] = '\0';
    G_log("2022/07/20--------------------------------------------buf=%s------------------------------",buf);

    // for(u8 i;i
    //     G_log("2022/07/20--------------------------------------------buf[%d]=%s------------------------------",i,buf[i]);


    /* log_info("%s",buf); */
}

你可能感兴趣的:(单片机,c语言)