关于万年历的一些小问题

2019-07-15 08:40发布

switch(count)                          {                                  case 1:                          temp=ds1302_read_byte(0x80);  //读取秒数                                                  temp=temp+1;  //秒数加1                          up_flag=1;    //数据调整后更新标志                                                  if((temp&0x7f)>0x59)   //超过59秒,清零                          temp=0;                                                                                                                    break;                           case 5:                          temp=ds1302_read_byte(0x86);  //读取日数                                                  temp=temp+1;  //日数加1                          up_flag=1;                                                  if(temp>0x31)                                                  temp=1;                                                  break;                           case 6:                          temp=ds1302_read_byte(0x88);  //读取月数                                                  temp=temp+1;  //月数加1                                                  up_flag=1;                                                  if(temp>0x12)                                                  temp=1;                                                  break;                           case 7:                          temp=ds1302_read_byte(0x8c);  //读取年数                                                  temp=temp+1;  //年数加1                          up_flag=1;                                                  if(temp>0x85)                                                  temp=0;                                                  break;                               default:break;
请问 if(temp>0x85)   if(temp>0x12)   if(temp>0x31)   if((temp&0x7f)>0x59) 该怎么理解呢?temp=temp-1;  //年数减1if(temp==-1)temp=0x85甚至还有这个????59这个整数怎么变成进制0x59来比较的??不是应该temp大于十进制的59的吗
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。