PDA

View Full Version : Best way to synchronize PINK with an LED display? Pg 2 of PINK manual unclear..



latigerlilly
02-09-2007, 11:51 PM
Hi guys,

The following program in this post doesn't work. It will not light up the LED display at all. The funny thing is, the program in the second post in this thread does light up the LED display. The parts of the program that lights up the LED display are identical in the two programs.

Basically, I want to use an online form to update variable 01 in the PINK. Then, the Basic Stamp 2p40 on the PDB will check what the value of this variable is. If it is "god", then the LED display on the PDB will show "god". If it is "odd" then the LED display on the PDB will show "odd". Otherwise, the LED display will show "dog". The funny thing is, it will not display anything, not even "dog". MY QUESTION, "What am I doing wrong that will not allow the LED display to work in this post but allows the LED display to work in the second post in this thread?

The problem is not with the online form. The online form will update the varialbe fine. It will also display the variable with no problems. The third post in this thread contains the online form.

I have connected the PINK to my Stamp 2P40 on the PDB according to the illustration on page 2 of the PINK manual: www.parallax.com/dl/docs/prod/comm/30013-PINK-v1.02.pdf (http://www.parallax.com/dl/docs/prod/comm/30013-PINK-v1.02.pdf) The only thing I can think of is, the PINK manual says "serial out" on the PINK is connected to P12 on the BASIC STAMP. I am interpreting this as "out" on the PINK is connected to "in" on the BASIC stamp. So, P12 is "serial in" on the Basic Stamp. In other words, you will use "SERIN 12,1021,[STR NBVAR\3]" to receive data from PINK to the Basic Stamp. Am I correct or wrong? Here is a schematic:
http://i15.photobucket.com/albums/a371/MINGMAY/dog.gif

Thanks,
Lilly. http://forums.parallax.com/images/smilies/smile.gif

HERE IS THE PROGRAM THAT DOESN'T WORK**********

' Learning on the PDB - experimental.bs2p

' Spells "dog" on the 7 segment LED display on the PDB as the default.
' Spells "god" on the 7 segment LED display on the PDB when PINK sends the variable into pin 12.
' Spells "odd" on the 7 segment LED display on the PDB when PINK sends the variable into pin 12.
' 7 segment LED display has digits 4, 3, and 2 used on X19.
' 7 segment LED display has segments A through G used on X18. Segment DP is not used.
' Digits 4, 3, and 2 are connected to P5, P4, and P3, respectively.
' Segments A, B, C, D, E, and F are connected to P6, P7, P8, P9, P10, and P11, respectively.
' Segment G is connected to P14.

' {$STAMP BS2p}
' {$PBASIC 2.5}

counter VAR Word
NBVAR VAR Byte(3)

GOSUB l4

DO
AUXIO
SEROUT 13,1021,["!NB0R01"]
SERIN 12,1021,[STR NBVAR\3]
MAINIO
IF (NBVAR(0) = "g") THEN

' If PINK sends god then display god

FOR counter = 1 TO 33
GOSUB hg
PAUSE 5
GOSUB h4
GOSUB l3
GOSUB lg

GOSUB ho
PAUSE 5
GOSUB h3
GOSUB l2
GOSUB lo

GOSUB hd
PAUSE 5
GOSUB h2
GOSUB l4
GOSUB ld
NEXT

ELSEIF (NBVAR(0) = "o") THEN

' If PINK sends odd then display odd

FOR counter = 1 TO 33
GOSUB ho
PAUSE 5
GOSUB h4
GOSUB l3
GOSUB lo

GOSUB hd
PAUSE 5
GOSUB h3
GOSUB l2
GOSUB ld

GOSUB hd
PAUSE 5
GOSUB h2
GOSUB l4
GOSUB ld
NEXT

ELSE

'If PINK sends neither god nor odd then display dog.

GOSUB hd
PAUSE 5
GOSUB h4
GOSUB l3
GOSUB ld

GOSUB ho
PAUSE 5
GOSUB h3
GOSUB l2
GOSUB lo

GOSUB hg
PAUSE 5
GOSUB h2
GOSUB l4
GOSUB lg

ENDIF
LOOP

l4:
MAINIO
LOW 5
RETURN

l3:
MAINIO
LOW 4
RETURN

l2:
MAINIO
LOW 3
RETURN

h4:
MAINIO
HIGH 5
RETURN

h3:
MAINIO
HIGH 4
RETURN

h2:
MAINIO
HIGH 3
RETURN

hd:
MAINIO
HIGH 7
AUXIO
HIGH 14
HIGH 10
HIGH 8
HIGH 9
RETURN

ld:
MAINIO
LOW 7
AUXIO
LOW 14
LOW 10
LOW 8
LOW 9
RETURN

ho:
AUXIO
HIGH 14
HIGH 10
HIGH 8
HIGH 9
RETURN

lo:
AUXIO
LOW 14
LOW 10
LOW 8
LOW 9
RETURN

hg:
MAINIO
HIGH 6
HIGH 7
AUXIO
HIGH 14
HIGH 11
HIGH 8
HIGH 9
RETURN

lg:
MAINIO
LOW 6
LOW 7
AUXIO
LOW 14
LOW 11
LOW 8
LOW 9
RETURN

Post Edited (latigerlilly) : 2/9/2007 3:59:55 PM GMT

latigerlilly
02-09-2007, 11:53 PM
**********THIS PROGRAM WORKS BUT WITHOUT PINK

' Learning on the PDB - experimental.bs2p

' Spells "dog" on the 7 segment LED display on the PDB as the default.
' Spells "god" on the 7 segment LED display on the PDB when button 1 connected to RB0 is pressed.
' Spells "odd" on the 7 segment LED display on the PDB when button 2 connected to RB1 is pressed.
' 7 segment LED display has digits 4, 3, and 2 used on X19.
' 7 segment LED display has segments A through G used on X18. Segment DP is not used.
' Digits 4, 3, and 2 are connected to P5, P4, and P3, respectively.
' Segments A, B, C, D, E, and F are connected to P6, P7, P8, P9, P10, and P11, respectively.
' Segment G is connected to P14.

' {$STAMP BS2p}
' {$PBASIC 2.5}

DEBUG "Program Running!"

counter VAR Word

GOSUB l4

DO
MAINIO
IF (IN8 = 0) THEN

' If button 1 is pressed then display god

FOR counter = 1 TO 33
GOSUB hg
PAUSE 5
GOSUB h4
GOSUB l3
GOSUB lg

GOSUB ho
PAUSE 5
GOSUB h3
GOSUB l2
GOSUB lo

GOSUB hd
PAUSE 5
GOSUB h2
GOSUB l4
GOSUB ld
NEXT

ELSEIF (IN9 = 0) THEN

' If button 2 is pressed then display odd

FOR counter = 1 TO 33
GOSUB ho
PAUSE 5
GOSUB h4
GOSUB l3
GOSUB lo

GOSUB hd
PAUSE 5
GOSUB h3
GOSUB l2
GOSUB ld

GOSUB hd
PAUSE 5
GOSUB h2
GOSUB l4
GOSUB ld
NEXT

ELSE

'If no button is pressed then display dog.

GOSUB hd
PAUSE 5
GOSUB h4
GOSUB l3
GOSUB ld

GOSUB ho
PAUSE 5
GOSUB h3
GOSUB l2
GOSUB lo

GOSUB hg
PAUSE 5
GOSUB h2
GOSUB l4
GOSUB lg

ENDIF
LOOP

' Sets digit 4 of display on vss.
l4:
MAINIO
LOW 5
RETURN

' Sets digit 3 of display on vss.
l3:
MAINIO
LOW 4
RETURN

' Sets digit 2 of display on vss.
l2:
MAINIO
LOW 3
RETURN

' Sets digit 4 of display on vdd.
h4:
MAINIO
HIGH 5
RETURN

' Sets digit 3 of display on vdd.
h3:
MAINIO
HIGH 4
RETURN

'Sets digit 2 of display on vdd.
h2:
MAINIO
HIGH 3
RETURN

' Sets segments of display for the letter d on vdd.
hd:
MAINIO
HIGH 7
AUXIO
HIGH 14
HIGH 10
HIGH 8
HIGH 9
RETURN

' Sets segments of display for the letter d on vss.
ld:
MAINIO
LOW 7
AUXIO
LOW 14
LOW 10
LOW 8
LOW 9
RETURN

' Sets segments of display for the letter o on vdd.
ho:
AUXIO
HIGH 14
HIGH 10
HIGH 8
HIGH 9
RETURN

' Sets segments of display for the letter o on vss.
lo:
AUXIO
LOW 14
LOW 10
LOW 8
LOW 9
RETURN

' Sets segments of display for the letter g on vdd.
hg:
MAINIO
HIGH 6
HIGH 7
AUXIO
HIGH 14
HIGH 11
HIGH 8
HIGH 9
RETURN

' Sets segments of diplay for the letter g on vss.
lg:
MAINIO
LOW 6
LOW 7
AUXIO
LOW 14
LOW 11
LOW 8
LOW 9
RETURN

latigerlilly
02-09-2007, 11:55 PM
*********ONLINE FORM FOR PINK THAT WORKS

<html>
<head>

</head>

<body>

<big><b><center>Pink Experimental Webpage</center></b></big>

The value of variable 01 is: <Nb_var01>

<FORM method="post" action="/experwebpage.html">
<P>
What value would you like stored in variable 01?
<INPUT name="Nb_var01" type="text" size="3" maxlength="3">
<INPUT type="submit">
</P>
</FORM>

</body>
</html>

Chris Savage
02-10-2007, 12:45 AM
Hello,

The PINK documentation will be revised to be more clear. The current documentation makes reference only to the physical pin on the module when it should refer to an I/O pin number. Physical pin 12 as shown in the diagram is actually P7. So P7 is the input on the BS2 in that example from the serial out of the PINK. The line connected to pin 13 is actually P8. These will be changed in a future revision of the documentation and both pins will be on the same I/O group. Hopefully this will help you out. Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

latigerlilly
02-10-2007, 06:07 PM
Please tell me what I did wrong. The LED display in the first post in this thread still will not turn on. I double checked. All the connections were tight and the BS2P40 is flush mounted tightly on the PDB. Not even the default "dog" would turn on. Thank you.