Shop OBEX P1 Docs P2 Docs Learn Events
strange serial out results — Parallax Forums

strange serial out results

ArchiverArchiver Posts: 46,084
edited 2003-05-01 02:05 in General Discussion
Has anyone ever seen this one.

I am sending data out serially from from data formatted previously
from a scratch pad string input. See below:

SERIN 1, 240, 20000, NODATA, [noparse][[/noparse]SPSTR 54]

SERSTRING VAR BYTE(15)
SERSTRING(0) = "2'
SERSTRING(1) = "0"
SERSTRING(2) = "1"
SERSTRING(3) = $89
SERSTRING(4) = $01
GET 21, SERSTRING(5)
GET 22, SERSTRING(6)
GET 12, SERSTRING(7)
GET 13, SERSTRING(8)
GET 27, SERSTRING(9)
GET 28, SERSTRING(10)
GET 41, SERSTRING(11)
GET 42, SERSTRING(12)
GET 51, SERSTRING(13)
GET 46, SERSTRING(14)

SEROUT 5\6, 16624, [noparse][[/noparse]STR SERSTRING\17]

Two problems:

1) If [noparse][[/noparse]STR SERSTRING\17] is shorter than 17 the last bits get
clipped off.

The end of the string has a strange unknown character added at the
end, a DEC 15 (hex0F).

2) Later on in the program I wanted to add some more varriables and
the end of the string gets the new variable values. See below:

V1 VAR BYTE
V2 VAR BYTE
V3 VAR BYTE
V4 VAR BYTE

V1 = SERSTRING(5)
V2 = SERSTRING(6)
V3 = SERSTRING(7)
V4 = SERSTRING(8)

The v1-4 values were added to the SERSTRING the second pass through
the program.


Any Ideas??????

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-05-01 02:05
    >SERSTRING VAR BYTE(15)
    >...
    >SEROUT 5\6, 16624, [noparse][[/noparse]STR SERSTRING\17]

    It is sending 17 bytes, but the variable array contains only 15. The
    last two bytes sent will be whatever happens to be in memory after
    the array.

    -- Tracy
Sign In or Register to comment.