Real-Time Clock
Original instructions
Introduction
Each BMX P34 xxxxx processor has a real-time clock which manages:
When power of the processor is turned off, the real-time clock continues counting during four weeks. This duration is guarantied for a temperature below 45°C (113°F). At a higher temperature this duration is reduced. No maintenance is requested for a real-time clock back up.
Current Date and Time
The processor updates the current date and time in the system words %SW49...%SW53 and %SW70. This data is in BCD (Binary Coded Decimal).
System Word
Most Significant Byte
Least Significant Byte
%SW49
00
Days of the week in the range of values 1 - 7 (1 for Monday and 7 for Sunday)
%SW50
Seconds (0 - 59)
00
%SW51
Hours (0 - 23)
Minutes (0 - 59)
%SW52
Month (1 - 12)
Days of the month (1 - 31)
%SW53
Century (0 - 99)
Year (0 - 99)
%SW70
Week (1 - 52)
Accessing the Date and Time
You can access the date and time as follows:
The following table shows the function performed by each bit in the word %SW59.
Bit Range
Function
0
Increments the day of the week
1
Increments the seconds
2
Increments the minutes
3
Increments the hours
4
Increments the days
5
Increments the months
6
Increments the years
7
Increments the centuries
8
Decrements the day of the week
9
Decrements the seconds
10
Decrements the minutes
11
Decrements the hours
12
Decrements the days
13
Decrements the months
14
Decrements the years
15
Decrements the centuries
NOTE: The function is performed when the corresponding bit %S59 is at 1.
NOTE: The processor does not automatically manage Daylight Savings Time.
Date and Time of the Last Application Shutdown
The date and time of the last application shutdown are in BCD in the system words %SW54 - %SW58.
System Word
Most Significant Byte
Least Significant Byte
%SW54
Seconds (0 to 59)
00
%SW55
Hours (0 to 23)
Minutes (0 to 59)
%SW56
Month (1 to 12)
Days of the month (1 to 31)
%SW57
Century (0 to 99)
Year (0 to 99)
%SW58
Day of the week (1 to 7)
Reason for the last application shutdown
The reason for the last application shutdown can be accessed by reading the least significant byte of the system word %SW58 (value in BCD) which can have the following values.
Word value %SW58
Meaning
1
Application switched to STOP mode.
2
Application stopped by watchdog.
4
Power loss or memory card lock operation.
5
Stop on hardware fault.
6
Stop on software fault (HALT instruction, SFC errors, application CRC check fail, undefined system function call, etc). Details on the software fault type are stored in %SW125.