Shop OBEX P1 Docs P2 Docs Learn Events
Connection with PINK — Parallax Forums

Connection with PINK

yuxianyuxian Posts: 3
edited 2010-04-03 03:21 in BASIC Stamp
I have a PINK Connected with my BASIC Stamp 2E. PINK and Stamp works fine seperately.

But I can't seem to get both work together.

This is my test program:

'{$STAMP BS2e}
'{$PBASIC 2.0}
'{$PORT COM5}

NBVAR VAR Byte
SEROUT 8,2400,[noparse][[/noparse]"!NB0R01"]
SERIN 7,2400,[noparse][[/noparse]NBVAR]

DEBUG DEC NBVAR

END



Let say my variable 1 for pink's default value is 12345

But nothing ever seem to happen.

Another question.

In this line of code

SEROUT [b]8[/b],2400,[noparse][[/noparse]"!NB0R01"]




What does the 8 do?

Sorry but I am kind of new to all these.

Comments

  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2010-04-02 11:14
    Your Baud Mode setting is not correct. Read the documentation for Serin/Serout to determine the correct value for your Stamp version (BS2E).

    This code will let you set the baud mode for 9600bps based on the $Stamp Directive

    #SELECT $STAMP························· ' Select Baud constants
    · #CASE BS2, BS2E, BS2PE
    ··· T1200······ CON···· 813
    ··· T2400······ CON···· 396
    ··· T4800······ CON···· 188
    ··· T9600······ CON···· 84
    ··· T19K2······ CON···· 32
    · #CASE BS2SX, BS2P
    ··· T1200······ CON···· 2063
    ··· T2400······ CON···· 1021
    ··· T4800······ CON···· 500
    ··· T9600······ CON···· 240
    ··· T19K2······ CON···· 110
    · #CASE BS2PX
    ··· T1200······ CON···· 3313
    ··· T2400······ CON···· 1646
    ··· T4800······ CON···· 813
    ··· T9600······ CON···· 396
    ··· T19K2······ CON···· 188
    #ENDSELECT
    Inverted······· CON···· $4000················ 'Value for inverted serial format
    Baud··········· CON···· T9600················ ·''8,N,1 not inverted
    InvBaud······· CON···· T9600 + Inverted·· '8,N,1 inverted

    SEROUT·8,Baud,[noparse][[/noparse]"!NB0R01"]
    SERIN·7,Baud,[noparse][[/noparse]NBVAR]

    The 8 in Serout instruction is the stamp pin number you have connected to the PINK RX pin, while the 7 in the Serin instruction is the pin you have connected to the PINK TX pin
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2010-04-03 03:21
    Better yet, try the examples that come with the documentation. They will verify everything is working properly as long as you connect the module according to the documentation.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    ·
Sign In or Register to comment.