SX10508: Serial Logging

The SX10508 allows data to be logged over a serial port.

Apart from a few special commands (listed below), anything sent over the serial port will be logged to the file.

Special Commands

Commands are sent to the logger in ASCII format, wrapped in "curly braces".  Keyword (command) matches are generally case-insensitive, so for example {newfile}  could be written as {NEWFILE} or {nEwFiLe}, etc.  Matching is performed using the aComRx_StrFind command.

{DateStamp e/n/Y H:M}

 This command instructs the logger to insert a date stamp from its current Real-Time Clock value in the given format.  The arguments could be in any desired order, with any desired separators (?, :, etc).  These arguments are case-sensitive.

Argument Meaning    Notes
a Day of Week Writes the abbreviated name of the current day of the week (Mon-Sun)
e Day of Month Writes the current day of the month (1-31)
m Month 0 Writes the current month as a number with a leading 0 (01-12)
n Month Writes the current month as a number (1-12)
Y Year Writes the current year as a 4-digit number, epoch 2000 (2000-2099)
H Hour Writes the current hour in 24-hour format with a leading 0 (00-23)
l 12-Hour Writes the current hour in 12-hour format with a leading 0 (01-12)
M Minute Writes the current minute with a leading 0 (00-59)
S Second Writes the current second with a leading 0 (00-59)
P am/pm Writes "am" or "pm" in lower-case
p AM/PM Writes "AM" or "PM" in upper-case

Yes, the "P" and the "p" write "am/pm" or "AM/PM" in the opposite case to the "P" or the "p".  Full SPLat source for this "default" application is available on the website here, so you can adjust it if you like (or even add new keywords).

The format in the heading will create a datestamp as follows:

d/m/20yy HH:MM

For example:

27/11/2019 01:23

 

{NewFile}

This command instructs the logger to close the existing file and create a new file.  There is no option to set the file name in this format: It simply increments the number of the file.

{NewFile filename.ext}

This command is new from 17 March 2023 (firmware version 4.7, SPLatware version 2.1.5).  It instructs the logger to close the existing file and create a new file with the configured name in 8.3 format (fewer characters is also allowable).  If the file name matches one already on the SD card, it will overwrite the existing file.

{FlushData}

This causes the data in the buffer to be written to the SD card.  Use this command sparingly: It contributes to wear on the SD card.

If you don't use this, however, the data won't be written until the 32KB buffer in the card hardware is full.

 

Most of the above formats and comments apply for Xwire logging as well.

 See also Serial Programming