Shop OBEX P1 Docs P2 Docs Learn Events
Serial commumications issue on BS2 — Parallax Forums

Serial commumications issue on BS2

ArchiverArchiver Posts: 46,084
edited 2001-08-16 20:35 in General Discussion
I'm using my BS2 pin 16 as a serin/serout to a PC with VB. When I
send commands to the stamp it works fine.

Command string looks like this in VB:

MSComm1.ouput = chr$(146) & CHR$(Comand) & CHr$(Data)

Stamp recives with this command

serin 16,84, [noparse][[/noparse]wait (146), command,data]
then process command and data then send results

serout 16,84,[noparse][[/noparse]dec3 data,dec3 data1,dec3 data2,dec3 data3]

VB code looks something like this

MSComm1.input = Alldata

data = mid(alldata,1,3)
data1= mid(alldata,4,3)
etc...

Now when I try and send data results back from the stamp I get
garbage in the beginning and only parts of my result. Garbage being
funky looking characters.

What would be causing these errors? I'm running at either 2400 or
9600 baud. I know to gnd the one pin on the stamp when doing serial
commands through the serial connection. I hope what I described is
enough to give suggestions. This is really putting a damper on my
progress.

Thanks for any and all help. This group has been very generous in
there time.

Shawn

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-08-16 20:35
    Just a quick question:

    Do you know that using port 16 echos back everything you send from VB back
    to VB? That might explain your results. The reason is the Stamp
    "steals" -12V from the RS-232 port. In the process, the voltage that the
    Stamp routes back around causes an echo to appear.

    You can change your program to "eat" the echoed characters or you can move
    off of port 16 (hint: look at http://www.al-williams.com/awce/rs1.htm if you
    want a simple way to do that).

    Al Williams
    AWC
    * 8 channels of PWM
    http://www.al-williams.com/awce/pak5.htm

    >
    Original Message
    > From: shawnusa@e... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=jdyLyqKtoeK9RltAliqbz22Yu9xvfQ3mp2cauvXYHjJ2CoYNeMEf_CaFRN4CPfUYGE7I0O57l_wv]shawnusa@e...[/url
    > Sent: Thursday, August 16, 2001 2:15 PM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] Serial commumications issue on BS2
    >
    >
    >
    >
    > I'm using my BS2 pin 16 as a serin/serout to a PC with VB. When I
    > send commands to the stamp it works fine.
    >
    > Command string looks like this in VB:
    >
    > MSComm1.ouput = chr$(146) & CHR$(Comand) & CHr$(Data)
    >
    > Stamp recives with this command
    >
    > serin 16,84, [noparse][[/noparse]wait (146), command,data]
    > then process command and data then send results
    >
    > serout 16,84,[noparse][[/noparse]dec3 data,dec3 data1,dec3 data2,dec3 data3]
    >
    > VB code looks something like this
    >
    > MSComm1.input = Alldata
    >
    > data = mid(alldata,1,3)
    > data1= mid(alldata,4,3)
    > etc...
    >
    > Now when I try and send data results back from the stamp I get
    > garbage in the beginning and only parts of my result. Garbage being
    > funky looking characters.
    >
    > What would be causing these errors? I'm running at either 2400 or
    > 9600 baud. I know to gnd the one pin on the stamp when doing serial
    > commands through the serial connection. I hope what I described is
    > enough to give suggestions. This is really putting a damper on my
    > progress.
    >
    > Thanks for any and all help. This group has been very generous in
    > there time.
    >
    > Shawn
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
Sign In or Register to comment.