PDA

View Full Version : Serin parameters ??



Rony
- 17th August 2011, 19:04
Hi all,

i want to read serial data using serin but the trame i am receiving is not always with the same size and it has not always the same bytes at the end (to wait for and stop reading).

i want to use it as when using hserin ( hserin timeout,label,[str buffer\80] ) if possible, but i noticed that i can't use "str variable\x", any help :confused: ??

Thank you :)

mister_e
- 17th August 2011, 19:07
perhaps SERIN2 or DEBUGIN?

Rony
- 17th August 2011, 19:20
i think serin2 will work, i didn't pay attention for that before :(
thank you Steve :)

Rony
- 21st August 2011, 09:32
i am trying with serin2, the timeout is working properly,
but i faced another problem which is the [str varname\n]

serin2 IN_PIN,84,[str buffer\2] ' baud 9600
if buffer[0] = "A" and buffer[1] = "B" then
LED1 = 1
LED2 = 0
else
LED1 = 0
LED2 = 1
endif

The above code makes LED2 ON when sending "AB" to the microcontroller (which is wrong) while the below code makes LED1 ON (which is correct)

serin2 IN_PIN,84,[buffer[0],buffer[1]]
if buffer[0] = "A" and buffer[1] = "B" then
LED1 = 1
LED2 = 0
else
LED1 = 0
LED2 = 1
endif

where is the problem in my code ???
i have a buffer of around 50 bytes, so it is preferable to use the [str buffer\50]

Note that i tested the debugin instead of serin2, but same problem !!!

mister_e
- 21st August 2011, 16:19
mmm... weird, will test it here. Which PBP version do you have?

mister_e
- 21st August 2011, 16:58
No issue here...

Rony
- 21st August 2011, 18:01
My version is PBP 2.50C