Report Bugs Here

Moderator: Mmiscool

User avatar
By Lagnus
#62925 Hello,
i have the following problem:
I send 7 bytes to the esp (decimal): 2 5 22 0 4 3 22
I use the following code and get : 2 5 22 0 0 0 0
(if i send 11 bytes system hangs up)

serial2begin 9600, 14 , 12
textbox z$
serial2branch [serial2in]
wait

[serial2in]
serial2input a$
l = len(a$)
for i = 1 to l
b$ = asc(mid(a$,i,1))
z$ = z$ & " " & b$
next i
return
User avatar
By Electroguard
#62933 I seem to remember noticing in the past that 0 (zero) was being interpreted as a serial 'end of string' character which caused the partial string to be transmitted, therefore was unable to be transmitted as a numeric character representing zero.
So effectively, a string of numbers containing 0 or 00 or 000 etc will be interpreted as multiple strings of fewer numberic character lengths.
Should be easy enough for you to test for if you are aware.
User avatar
By Lagnus
#62967 If i send 7 bytes without zero's it works,
But if i send 11 bytes (without zero's) system hangs up.
So how could i solve this?

Is there a kind of watchdog in the espbasic?
User avatar
By Electroguard
#62971 You are reading and manipulating the serial input as ascii characters, therefore you need to be sending appropriate ascii codes to represent the numbers rather than the actual numeric byte values - which will get interpreted as ascii codes... and ascii codes lower than 32 (space) are seen as control codes which may do something unwanted and possibly cause weird symptoms.