Shop OBEX P1 Docs P2 Docs Learn Events
SEROUT Command formatting — Parallax Forums

SEROUT Command formatting

Could someone please tell me th emeaniong of $08, $20 .... $OD
in SEROUT TX\CTS, Baud, [$08, $20, $00, $00, $00, $0B, $0D,
DEC2 Temperature1, ".", DEC1 Decimal1, ",", DEC2 Temperature2, ".", DEC1 Decimal2, ",",
DEC2 Temperature3, ".", DEC1 Decimal3, ",", DEC2 Temperature4, ".", DEC1 Decimal4, ",", $0D]

Temperature3, Decimal3, Temperature4 and Decimal4 are not coming out correctly

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2016-12-19 22:24
    Welcome to the forum!

    The hex characters are for controlling the output, and their functions may differ depending upon the output device being written to. Typically, $08 is a backspace, $20 a space, $00 a clear screen, $0D a carriage return.

    What are you outputting to (e.g. DEBUG screen, LCD, etc.)? What are the values you're trying to print, and what does the output look like?

    -Phil
  • I am writing to parallax datalogger
    Recently added the temperature3 & temperature4 to the datalogger
    Changed $0B (hex value before $0D) to $15 and it worked - $0B=11 bytes and $15=21 bytes
    Each tempeature value is 5 bytes which is in xx.x, (like 68.5, )
    I was writing only 2 temps before and now 4 temps ==> 10 bytes to 20 bytes
    still dont undertand the function of [$08, $20, $00, $00, $00, $0B, $0D
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    I'd have to look it up to confirm, but that looks like the command to write a specific number of bytes to the Datalogger. The $08, $20 is the write command, the next 4 bytes are the number of bytes of data to write. $0B indicates 11 bytes and the $0D terminates the command, though I don't remember if that $0D is required in the new firmware.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2016-12-20 16:54
    Agreeing with Chris. The command is $08, followed by a space, followed by 4 bytes that are binary for the number of bytes to be written (up to 4294967295 of them), followed by an obligatory $0D, then the bytes to be written. The count is exacting. If the number stated in the command is not exact, the drive can seem to lock up, not respond to commands.

    There are other commands that you must be using in the same program, such as $09 $20 "filename" $0D to open the file.
  • Chris & Tracy, Thank you. Very helpful...
Sign In or Register to comment.