stm32 RTC时钟设置能不能用毫秒

具体的程序里面写的是

    RTC_SetAlarm(SENDTIME+RTC_GetCounter());

进入原函数看看发现是:
void RTC_SetAlarm(uint32_t AlarmValue)
{
    RTC_EnterConfigMode();
    /* Set the ALARM MSB word */
    RTC->ALRH = AlarmValue >> 16;
    /* Set the ALARM LSB word */
    RTC->ALRL = (AlarmValue & RTC_LSB_MASK);
    RTC_ExitConfigMode();
}

这样我写个测试

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>

int main()
{
//    char a[8] = "0x0000ffff";
//    uint32_t b = strtoul(a, NULL, 16);


    uint32_t AlarmValue = 300007;
    printf("32:%d\n",  AlarmValue); // 取整并打印结果
    printf("1:%04X\n",  AlarmValue); // 取整并打印结果
    AlarmValue >> 16;
    printf("1:%d\n",  AlarmValue); // 取整并打印结果
    AlarmValue=AlarmValue & 0x0000FFFF;
    printf("1:%d\n",  AlarmValue); // 取整并打印结果
    printf("1:%04X\n",  AlarmValue); // 取整并打印结果
    printf("1:%f\n",  AlarmValue); // 取整并打印结果

    return 0;






}

可以看见打印出来:



​​​​​​​

能看出来你实际上的是毫秒 设置300007 和设置300.07 效果一样,我不知道是不是个例,感觉C语言好高级 

12-05 08:05