SX10508: Serial Logging

COM Ports

The easiest way to log with the SX10508 is via the serial port.  The default application treats the COM ports as follows:

Commands

There are some special commands that may be sent to the COM1 (or RS485) logging port.  All commands are encapsulated in "{}".  Any command that isn't recognised will simply be written to the log file.

{datestamp [format]} Writes the SX10508's date/time to the current file
{newfile [filename.ext]} Closes the current file and opens a new one
{flushdata}    Forces buffered data to be written to the SD Card

Datestamp

The [format] string uses the following special characters to construct the date that will be written to the SD Card.

a Day Of Week as 3 characters, eg "Mon"
e Day of month, eg "7" for 7th February
m Month with leading 0, eg "02" for February, "12" for December.
n Month without leading 0
Y Year, eg "2016"
H 24 Hour with leading 0, eg "01" for 1AM, "19" for 7pm
l 12 Hour with leading 0, eg "10" for 10AM, "07" for 7pm
M Minutes with leading 0
S Seconds with leading 0
P am/pm as lower case 
p AM/PM as upper case

For example:


iiPrintText COMTTL,"{datestamp Y/m/e H:M:S}"

Will write something like 2016/09/26 11:31:05.

New File

Files on the SD card are named something like "00000341.csv".  When the card is inserted, the SX10508 will automatically sacn the filesystem and create a file whose number is larger than any other on the card.

{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.

See also More On Serial Programming