Writing Data to memory Stick Datalogger
I am having trouble·writing to the memory stick datalogger using the following bs2p40 code.
Var1··········· VAR···· Byte
Var2··········· VAR···· Nib
Var3··········· VAR···· Byte
Var4··········· VAR···· Nib
Var5··········· VAR···· Byte
Var6··········· VAR···· Byte
Var7··········· VAR···· Byte
Var8··········· VAR···· Byte
Var9··········· VAR···· Byte
··· GET 50, Var1······ ' Temperature1
··· GET 51, Var2······ ' Decimal1
··· GET 52, Var3······ ' Temperature2
··· GET 53, Var4······ ' Decimal2
··· GET 54, Var5······ ' sec
··· GET 55, Var6······ ' minute
··· GET 56, Var7······ ' hr
··· GET 57, Var8······ ' day
··· GET 58, Var9······ ' month
··· SEROUT TX\CTS, Baud, [noparse][[/noparse]$08, $20, $00, $00, $00, $0D, CR,
········· DEC Var1, ".", DEC1 Var2, ", ", DEC Var3, ".", DEC1 Var4,
········· HEX2 Var7, ":", HEX2 Var6, ":", HEX2 Var5, ",", HEX2 Var9, "/", HEX2 Var8, CR, LF, CR]
I tried DEC2 instead of HEX2 with no success.
However, it works if I reduce the number of variables to 4 as shown below.
· SEROUT TX\CTS, Baud, [noparse][[/noparse]$08, $20, $00, $00, $00, $0D, CR,
········· DEC Var1, ".", DEC1 Var2, ", ", DEC Var3, ".", DEC1 Var4, CR, LF, CR]
What is the function of three $00 commands?
Var1··········· VAR···· Byte
Var2··········· VAR···· Nib
Var3··········· VAR···· Byte
Var4··········· VAR···· Nib
Var5··········· VAR···· Byte
Var6··········· VAR···· Byte
Var7··········· VAR···· Byte
Var8··········· VAR···· Byte
Var9··········· VAR···· Byte
··· GET 50, Var1······ ' Temperature1
··· GET 51, Var2······ ' Decimal1
··· GET 52, Var3······ ' Temperature2
··· GET 53, Var4······ ' Decimal2
··· GET 54, Var5······ ' sec
··· GET 55, Var6······ ' minute
··· GET 56, Var7······ ' hr
··· GET 57, Var8······ ' day
··· GET 58, Var9······ ' month
··· SEROUT TX\CTS, Baud, [noparse][[/noparse]$08, $20, $00, $00, $00, $0D, CR,
········· DEC Var1, ".", DEC1 Var2, ", ", DEC Var3, ".", DEC1 Var4,
········· HEX2 Var7, ":", HEX2 Var6, ":", HEX2 Var5, ",", HEX2 Var9, "/", HEX2 Var8, CR, LF, CR]
I tried DEC2 instead of HEX2 with no success.
However, it works if I reduce the number of variables to 4 as shown below.
· SEROUT TX\CTS, Baud, [noparse][[/noparse]$08, $20, $00, $00, $00, $0D, CR,
········· DEC Var1, ".", DEC1 Var2, ", ", DEC Var3, ".", DEC1 Var4, CR, LF, CR]
What is the function of three $00 commands?

Comments
[noparse][[/noparse]$08, $20, $00, $00, $00, $0D, CR, ...
specifies that $0D = 13 bytes of data.
The number of bytes that follow the CR has to be counted exactly, and therefore do use modifiers like DEC2 that specify an exact number.
Suppose you follow with the following data (using DEC2 instead of DEC):
DEC2 Var1, ".", DEC1 Var2, ", ", DEC2 Var3, ".", DEC1 Var4, " ", HEX2 Var7, ":", HEX2 Var6, ":", HEX2 Var5, ",", HEX2 Var9, "/", HEX2 Var8, CR, LF]
By my count that is 26 bytes, not 13.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Thank you... I understand the SEROUT command structure for the datalogger now.
One more question: How did you count 26 bytes in the following?
DEC2 Var1, ".", DEC1 Var2, ", ", DEC2 Var3, ".", DEC1 Var4, " ", HEX2 Var7, ":", HEX2 Var6, ":", HEX2 Var5, ",", HEX2 Var9, "/", HEX2 Var8, CR, LF]
Var 1 thru Var 9 is 8 Bytes since 2 of the variables are NIB's.·What is the byte count of ASCII characters like "." ",", etc?·
DEC2 VarX will always send 2 bytes, that is, two ascii characters in the range of $30 to $39, no matter what the size of variable VarX. If VarX is a bit variable with value 1, then DEC2 VarX will transmit $30 #31, the ascii characters for "01". On the other hand is VarX is a word variable with value 12345, then DEC2 VarX will transmit $34 $35, the ascii codes for "45". Each character like "." or "/" is also a one byte ascii code.
DEC2=2 instances times 2 bytes total 4 bytes
HEX2=5 instances times 2 bytes total 10 bytes
DEC1 =2 instances times 1 byte total 2 bytes
punctuation total 8 bytes
CRLF total 2 bytes
Grand Total = 26 bytes
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com