A strange problem has been found recently. The system time Year of Our WinCE device is incorrect. The specific situation is: after 2010, when the system time reaches the entire point, the Year will jump to 2016, and then immediately jump back to 2010. Furthermore, double-click the time icon in the lower-right corner to open the "date/time attribute" dialog box. For this reason, I wrote a small piece of code to get the system time in the code, and then display the time on a Static control. In this way, we can easily find this phenomenon. If we manually Change the system time from 2010 to 2011, the phenomenon will change to 2011, jump to 2017, and then jump back to 2011. This small hop will cause many application errors.
Then open the timer. c file under/KERNEL/HAL/ARM. The code segment that encountered the above problem has been found:
Lpst-> wSecond = FROM_BCD (s2440RTC-> rBCDSEC & 0x7f); </p> <p> lpst-> wMinute = FROM_BCD (s2440RTC-> rBCDMIN & 0x7f ); </p> <p> lpst-> wHour = FROM_BCD (s2440RTC-> rBCDHOUR & 0x3f ); </p> <p> lpst-> wDayOfWeek = (s2440RTC-> rBCDDATE-1 ); </p> <p> lpst-> wDay = FROM_BCD (s2440RTC-> rBCDDAY & 0x3f ); </p> <p> lpst-> wMonth = FROM_BCD (s2440RTC-> rBCDMON & 0x1f ); </p> <p> // lpst-> wYear = (2000 + s2440RTC-> rBCDYEAR ); </p> <p> lpst-> wYear = FROM_BCD (s2440RTC-> rBCDYEAR) + 2000; </p> <p> if (lpst-> wSecond = 0) </p> <p >{</p> <p> lpst-> wSecond = FROM_BCD (s2440RTC-> rBCDSEC & 0x7f ); </p> <p> lpst-> wMinute = FROM_BCD (s2440RTC-> rBCDMIN & 0x7f ); </p> <p> lpst-> wHour = FROM_BCD (s2440RTC-> rBCDHOUR & 0x3f ); </p> <p> lpst-> wDayOfWeek = (s2440RTC-> rBCDDATE-1 ); </p> <p> lpst-> wDay = FROM_BCD (s2440RTC-> rBCDDAY & 0x3f ); </p> <p> lpst-> wMonth = FROM_BCD (s2440RTC-> rBCDMON & 0x1f ); </p> <p> lpst-> wYear = (2000 + s2440RTC-> rBCDYEAR); </p> <p >}< br/>
It can be seen that this strange phenomenon occurs only when the entire score is reached? This is because it is determined by the if (lpst-> wSecond = 0) condition. It seems that the Code executed in this if statement may be faulty. Here, the year code is: lpst-> wYear = (2000 + s2440RTC-> rBCDYEAR); changed:
Lpst-> wYear = 2000 + FROM_BCD (s2440RTC-> rBCDYEAR); the problem is all right.
The problem was solved according to the instructions of others. This BSP package was modified by another departing employee based on other BSP packages. Another problem is that SetTimer is incorrect. You cannot solve the problem by yourself. Record it first.