SX10509: Date and Time
The SX10509 synchronises the date and time on power-up, and every 24 hours, with an internet NTP server. The time and date are very easy to read out, and can be used for example to time stamp data being sent to the server.
The timezone offset for your local time may be set in the Time Configuration tab. If you set it to zero you will get GMT (Zulu time). There is no automatic provision for daylight saving time. You may choose to ignore both the date and time items, or have your controller receive one or both. Just add the address for each one you want to your Xwire configuration table.
The following tables depict how the Xwire data blocks need to appear in memory.
Time Address
The Xwire time address handles the internet synchronised time from the SX10509 real time clock. This is optional and requires its own an Xwire receive data block if used.
Note: This address is set to 65 by default but can be changed in the Xwire Configuration tab.
Xwire time receive data block:
| Memory | Description | Format |
|---|---|---|
| 0 | Hours | Byte |
| 1 | Minutes | Byte |
| 2 | Seconds | Byte |
Note that this data block does not need to start at memory location 0. The data block can be moved anywhere in memory as long as it stays together, is in the order above and is defined in the NVEM Xwire table in the program code.
Memory location 0 in the Xwire receive data block corresponds to the ‘Hours’, this is where the hour count from the SX10509 Real Time Clock will appear.
The ‘Hours’ byte is an 8-bit integer (binary) in 24-hour format.
Memory location 1 in the Xwire receive data block corresponds to the ‘Minutes’, this is where the minute count from the SX10509s Real Time Clock will appear.
Memory location 2 in the Xwire receive data block corresponds to the ‘Seconds’, this is where the second count from the SX10509s Real Time Clock will appear.
Date Address
The Xwire date address handles the internet synchronised Local Date from the SX10509 real time clock. This is optional and requires its own an Xwire receive data block if used.
Note: This address is set to 66 by default but can be changed in the Xwire Configuration tab.
Xwire date receive data block:
| Memory | Description | Format |
|---|---|---|
| 0 | Day of the Week | Byte |
| 1 | Day of the Month | Byte |
| 2 | Month | Byte |
| 3 | Year | Byte |
Note that this data block does not need to start at memory location 0. The data block can be moved anywhere in memory as long as it stays together, is in the order above and is defined in the NVEM Xwire table in the program code.
Memory location 0 in the Xwire date receive data block corresponds to the ‘Day of the Week’, this is where the day of the week from the SX10509’s Real Time Clock will appear.
The byte will contain a binary number 0-6. 0 = Sunday. 6 = Saturday.
Memory location 1 in the Xwire receive data block corresponds to the ‘Day of the Month’, this is where the day of the month from the SX10509’s Real Time Clock will appear.
The byte ranges from 1 thru 31 depending upon the number of days in the month.
Memory location 2 in the Xwire receive data block corresponds to the ‘Month’, this is where the month from the SX10509’s Real Time Clock will appear.
The month ranges from 1 (January) thru 12 (December).
Memory location 3 in the Xwire receive data block corresponds to the ‘Year’, this is where year from the SX10509’s Real Time Clock will appear. This is the year since 2000, so if a number of 10 was recalled from the ‘Year’ byte it would mean it’s 2010.
Time Xwire buffer example:
To access this time, setup your SPLat controller with a zero length transmit buffer and a 3 byte receive buffer, for example:
;SX10509 TIME buffer
defBLOCK 3 ;receive buffer
bHour defBYTE
bMin defBYTE
bSec defBYTE
NVEM0
;SX10509 Xwire TIME configuration
NV0Byte 65 ;Address of the SX10509 SPLat Call Home board, TIME
NV0Byte 0 ;Address of the Tx buffer (placeholder ... there is none)
NV0Byte 0 ;Length of the Tx buffer (there is none)
NV0Byte bHour ;Address of the Rx buffer
NV0Byte 3 ;Length of the Rx buffer
NV0Byte 255 ;End of table sentinel.
As shown in the example above, the time will be returned in 3 bytes as hours, minutes and seconds. Hours ranges from 0 thru 23, that is, 24 hour time.
Date Xwire buffer example:
To access this time, setup your SPLat controller with a zero length transmit buffer and a 4 byte receive buffer, for example:
;SX10509 DATE Buffer
defBLOCK 4 ;receive buffer
bWDay defBYTE
bMDay defBYTE
bMon defBYTE
bYear2000 defBYTE
NVEM0
;SX10509 Xwire DATE configuration
NV0Byte 66 ;Address of the SX10509 SPLat Call Home board, DATE
NV0Byte 0 ;Address of the Tx buffer
NV0Byte 0 ;Length of the Tx buffer
NV0Byte bYear2000 ;Address of the Rx buffer
NV0Byte 4 ;Length of the Rx buffer
NV0Byte 255 ;End of table sentinel.
As shown in the example above, the date will be returned in 4 bytes as day of week, day of month, month and year since 2000.