欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索

為什么STM32打印出來的時間這么奇怪?麻煩一下大佬幫我分析一下

查看數(shù): 3325 | 評論數(shù): 3 | 收藏 0
關燈 | 提示:支持鍵盤翻頁<-左 右->
    組圖打開中,請稍候......
發(fā)布時間: 2019-3-3 09:59

正文摘要:

為什么打印出來的時間這么奇怪呢,求解,謝謝 #include "stm32f10x.h" #include "delay.h" #include "sys.h" #include "oled.h" #include "bmp.h" #include "ds1302.h" #include ...

回復

ID:386367 發(fā)表于 2019-3-4 00:08
代碼邏輯上沒問題。我記得printf是不能傳入太多叁數(shù)。7個叁數(shù)可能太多了, 試試只傳入秒的數(shù)據(jù)。
ID:94031 發(fā)表于 2019-3-3 11:42
用仿真先看從DS1302讀到的時間正常嗎。

評分

參與人數(shù) 1黑幣 +40 收起 理由
admin + 40 回帖助人的獎勵!

查看全部評分

ID:277550 發(fā)表于 2019-3-3 11:28
//從DS302讀出時鐘數(shù)據(jù)
void DS1302_Read_Time(void)  
{
        time_buf[1] = DS1302_Read_Byte(ds1302_year_add);                   //年
        time_buf[2] = DS1302_Read_Byte(ds1302_month_add);                   //月
        time_buf[3] = DS1302_Read_Byte(ds1302_date_add);                   //日
        time_buf[4] = DS1302_Read_Byte(ds1302_hr_add);                     //時
        time_buf[5] = DS1302_Read_Byte(ds1302_min_add);                     //分
        time_buf[6] = (DS1302_Read_Byte(ds1302_sec_add))&0x7f; //秒,屏蔽秒的第7位,避免超出59
        time_buf[7] = DS1302_Read_Byte(ds1302_day_add);                     //周        
}

//DS1302向上層返回時間數(shù)據(jù)
void DS1302_Get_Time(u8 *time)
{
        DS1302_Read_Time();
        time[0]=(time_buf[0]>>4);   //年   
  time[1]=(time_buf[0]&0x0f);
   
  time[2]=(time_buf[1]>>4);   
  time[3]=(time_buf[1]&0x0f);
  
  time[4]=(time_buf[2]>>4);   //月  
  time[5]=(time_buf[2]&0x0f);

  time[6]=(time_buf[3]>>4);   //日   
  time[7]=(time_buf[3]&0x0f);
   
  time[8]=(time_buf[7]&0x07); //星期
   
  time[9]=(time_buf[4]>>4);   //時   
  time[10]=(time_buf[4]&0x0f);   

  time[11]=(time_buf[5]>>4);  //分   
  time[12]=(time_buf[5]&0x0f);   

  time[13]=(time_buf[6]>>4);  //秒
  time[14]=(time_buf[6]&0x0f);
}

更新日期時間數(shù)組的部分程序有問題。。。。沒這硬件。。。。。調(diào)試原始的數(shù)據(jù)吧,看看具體哪讀的問題

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復 返回頂部 返回列表