PDA

View Full Version : STR & array



Tumbler
12-04-2009, 11:17 PM
Hello


SEROUT TX, Baud, ["!NB0RSI"]
GOSUB Getstring
DEBUG "IP Address: ", STR nbvar\16,CR

I want to·read my PINK IP address with this code, and output it to the debug window.
why i only see strange characters?
·

Franklin
12-04-2009, 11:21 PM
Could we see the rest of the code? From that snippet I'd say it was returning numeric data outside the printable data range.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

Tumbler
12-04-2009, 11:26 PM
' {$STAMP BS2sx}
RX PIN 14 ' Serial Receieve Pin --> PINK.TX
TX PIN 15 ' Serial Transmit Pin --> PINK.RX
Baud CON 240 ' 9600 bps (BS2sx)
nbvar VAR Byte(16) ' PINK Data Variable Array
Main:
SEROUT TX, Baud, ["!NB0RSI"]
GOSUB Getstring
DEBUG "IP Address: ", STR nbvar\16,CR
END
Timeout:
DEBUG "Communication Timeout!" ' Serial Timeout
END
Getstring:
SERIN RX, Baud, [STR nbvar\16\CLS]
RETURN

PINK settings are correct. I don't see what's wrong here

Tumbler
12-04-2009, 11:56 PM
Ok, i see that i was wrong here.

DEBUG DEC nbvar(0),":",DEC nbvar(1),":",DEC nbvar(2),":",DEC nbvar(3), CR

shows the correct values, but as you can see at the screenshot, my pink has every second another ip address?

http://www.tumbler.be/Chris/debug.gif

Franklin
12-05-2009, 10:51 AM
Have you successfully run the demo code?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

Tumbler
12-05-2009, 12:09 PM
Seems like the bs2sx is the problem here.
every sx sample failed.

With a normal BS2 and PE all samples work.

Franklin
12-06-2009, 03:49 AM
Are you changing the baudrate numbers? (just a thought)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

Tumbler
12-06-2009, 04:36 AM
I have test every baud rates,without succes (bs2sx)
Just getting strange chars.

But it's ok, i use a bs2 now.
Thx