PDA

View Full Version : Hserin amount



Christopher4187
- 25th February 2015, 12:59
I've found some threads that confirm the problem I'm having but none that provide a resolution.

Why doesn't this work:

HSERIN 1, [STR DAT\800\"@"]

But this does?

HSERIN 1, [STR DAT\255\"@"]

Is the maximum input for an array 255? The only way I can make it work right now is:

HSERIN 1, [STR DAT1\255\"@", STR DAT2\255\"@", STR DAT3\255\"@", STR DAT4\255\"@"]

pedja089
- 25th February 2015, 13:32
I use this code to receive string longer then 255 chars

FOR i=0 TO 799
HSEERIN 1, TimeOutLabel,[Chr] ' get char
IF Chr="@" THEN
GOTO Done 'End of data
ELSE
DAT[i]=Chr ' put char in array
ENDIF
NEXT i
Done:
DAT[i]=0 'End of string

aerostar
- 25th February 2015, 15:45
Make sure you declare variables that will be over 255 as words, also assume you have a typo in the above code "HSEERIN".

Art
- 1st March 2015, 05:32
Because the serial buffer is one byte. HSERIN looks at the one byte buffer received.
The idea is to cycle the rest of your program between bytes.