SX10508: Xwire Logging
The SX10508 uses 3 XWire addresses.
Xwire address 10 handles the Data that is sent to the SX10508 to be logged. This consists of an Xwire transmit and receive data block.
Xwire address 11 handles the Time from the SX10508 real time clock. This is optional and consists of receive data block.
Xwire address 12 handles the Date from the SX10508 real time clock. This is optional and consists of receive data block.
The following tables depict how the Xwire data blocks need to appear in memory.
Xwire address 10: Logging Data
Xwire transmit data block:
| Memory | Description | Format |
|---|---|---|
| 0 | Command | Byte |
| 1 | Length | Byte |
| 2 | Data0 | Byte |
| 3 | Data1 | Byte |
| … | … | … |
| n | DataN | 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 transmit data block corresponds to the ‘Command‘ as follows:
;--Logger Commands
XLkCMD_Idle EQU '00 ;no action
XLkCMD_Write EQU '01 ;write data, length is the number of bytes to write
XLkCMD_Datestamp EQU '02 ;write a datestamp, length is number of directive characters, data is directive characters
XLkCMD_NewFile EQU '03 ;data may be an optional file name, otherwise the automatic sequence number is used
XLkCMD_AppendFile EQU '04 ;data may be an optional file name, otherwise the automatic sequence number is used
XLkCMD_DeleteFile EQU '05 ;data may be an optional file name, otherwise the current file is deleted
XLkCMD_GetTime EQU '06 ;gets the time from the clock in the logger board, returns HOURS,MINUTES,SECONDS
XLkCMD_GetDate EQU '07 ;gets the date from the clock in the logger board, returns DAY,MONTH,YEAR (year is 00 - 99)
XLkCMD_GetDOW EQU '08 ;gets the day of week, 0 = Monday thru 6 = Sunday
XLkCMD_SetTime EQU '09 ;sets the time where DATA1 thru 3 are HOURS,MINUTES,SECONDS
XLkCMD_SetDate EQU '0A ;sets tha date where DATA1 thru 3 are DAY,MONTH,YEAR (year is 00 - 99)
XLkCMD_FlushData EQU '0B ;force any data currently in the cache to be written to the card (this may decrease the life of your card)
When the ‘Length‘ and ‘DataX‘ bytes have all been set, load the “Command” byte to instruct the logger to execute the command. Some of the details of the commands are explained in the Serial Logging page.
If you need to send the same command (like Write) multiple times, simply toggle bit 7 of the command byte. In essence, bit 7 can be thought of as a “RepeatCommand” bit. Be sure to toggle only after you’ve loaded the Data and Length bytes.
Memory location 1 in the Xwire transmit data block corresponds to the ‘Length‘ byte. This byte is set to the number of bytes of data that the Data Logger needs to log.
Memory location 2, 3,
The Transmit data block may consist of up to 32 bytes total.
Xwire receive data block:
| Memory | Description | Format |
|---|---|---|
| 0 | CommandEcho | Byte |
| 1 | Result | 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 ‘CommandEcho‘ byte from the Data Logger. When the ‘CommandEcho‘ byte matches the ‘Command‘ byte, the SDLogger has finished executing the command.
Memory location 1 in the Xwire receive data block corresponds to the ‘Result‘ byte from the Data Logger. After a log attempt, the ‘Result‘ byte will be set to a value of 0-5 depending on whether it was a success or a failure.
The following table depicts the result codes:
| Result byte | Description |
|---|---|
| 0 | Successful |
| 1 | Card Not Present |
| 2 | Card Write Protected |
| 3 | Unknown File system |
| 4 | Open Error |
| 5 | General Failure |
Xwire address 11: Time
Xwire 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 Data loggers Real Time Clock will appear.
The ‘Hours’ byte is 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 Data loggers 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 Data loggers Real Time Clock will appear.
Xwire address 12: Date
Xwire 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 receive data block corresponds to the ‘Day of the Week’, this is where the day of the week from the Data Loggers Real Time Clock will appear.
The byte will contain a 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 Data Loggers Real Time Clock will appear.
Memory location 2 in the Xwire receive data block corresponds to the ‘Month’, this is where the month from the Data Loggers Real Time Clock will appear.
Memory location 3 in the Xwire receive data block corresponds to the ‘Year’, this is where year from the Data Loggers 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.
Serial Logging
The SX10508 also allows serial logging, using ASCII strings.