PDA

View Full Version : Connection with PINK



yuxian
04-02-2010, 03:14 PM
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,["!NB0R01"]
SERIN 7,2400,[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 8,2400,["!NB0R01"]




What does the 8 do?

Sorry but I am kind of new to all these.

Ron Czapala
04-02-2010, 06:14 PM
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,["!NB0R01"]
SERIN·7,Baud,[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 Savage
04-03-2010, 10:21 AM
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
·