Shop OBEX P1 Docs P2 Docs Learn Events
STR & array — Parallax Forums

STR & array

TumblerTumbler Posts: 323
edited 2009-12-05 21:36 in BASIC Stamp
Hello
SEROUT TX, Baud, [noparse][[/noparse]"!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?
·

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-12-04 16:21
    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
  • TumblerTumbler Posts: 323
    edited 2009-12-04 16:26
    ' {$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, [noparse][[/noparse]"!NB0RSI"]
      GOSUB Getstring
      DEBUG "IP Address: ", STR nbvar\16,CR
     END
    Timeout:
      DEBUG "Communication Timeout!"        ' Serial Timeout
      END
    Getstring:
      SERIN  RX, Baud, [noparse][[/noparse]STR nbvar\16\CLS]
      RETURN
    

    PINK settings are correct. I don't see what's wrong here
  • TumblerTumbler Posts: 323
    edited 2009-12-04 16:56
    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?

    debug.gif
  • FranklinFranklin Posts: 4,747
    edited 2009-12-05 03:51
    Have you successfully run the demo code?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • TumblerTumbler Posts: 323
    edited 2009-12-05 05:09
    Seems like the bs2sx is the problem here.
    every sx sample failed.

    With a normal BS2 and PE all samples work.
  • FranklinFranklin Posts: 4,747
    edited 2009-12-05 20:49
    Are you changing the baudrate numbers? (just a thought)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • TumblerTumbler Posts: 323
    edited 2009-12-05 21:36
    I have test every baud rates,without succes (bs2sx)
    Just getting strange chars.

    But it's ok, i use a bs2 now.
    Thx
Sign In or Register to comment.