Shop OBEX P1 Docs P2 Docs Learn Events
pc to the bs2 through the rs232 port — Parallax Forums

pc to the bs2 through the rs232 port

kenobekenobe Posts: 7
edited 2005-08-28 05:59 in BASIC Stamp
Hi
I am trying to send command from the pc to the bs2 through the rs232 port connected to the serial port of the bs2. In the bs2 side, I mput

serin rx,16,16848,[noparse][[/noparse]data]

the problem is that I donot know if 'rx' is correct.
Thanks
jumpin.gif

Post Edited By Moderator (Chris Savage (Parallax)) : 8/27/2005 6:04:55 AM GMT

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-08-27 06:12
    Hello,

    ·· I see two problems with your serin command.· One is you're specifying the rx pin twice.· Once using the constant rx, of which I don't know the value, and again with the 16.· Also your Baud rate appears to be wrong.· If you're looking for 9600 baud on a BS2 it's 16468, not 16848.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • kenobekenobe Posts: 7
    edited 2005-08-27 11:40
    Hi chris
    Thanks
    I change to serin 16,16468 [noparse][[/noparse]data], it works.
    But when I look at the bs2 pin diagram , the 'sin' pin number is 2, not 16 , can you pls tell me why?
    ·
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-08-27 13:30
    Kenobe -

    You are confusing the physical pin numbers on the Stamp carrier board and the logical pin port numbers used by the Stamp Editor/Compiler/IDE, as assigned by the programmer. You need to look at the PBASIC Stamp Manual to see the whole picture. You can download a copy of that manual from this link:
    http://www.parallax.com/html_pages/downloads/basicstamps/documentation_basic_stamp.asp

    See the "Hardware" section of the "Introduction to the BASIC Stamps" chapter for more information on the above. You will find the PBASIC Stamp Manual to be an absolutely invaluable resource. Additionally, the Stamp Editor/Compiler/IDE has a HELP facility on the toolbar, which is very comprehensive, and helpful as well.

    SIN (aka DEBUG in) and SOUT (aka DEBUG out) are designated as pin port 16, and appear at the Stamp programming port (DB-9 conector) on a Stamp carrier board. This particular pin port is a specialized RS-232 port which supplies the appropriate RS-232 voltage levels (-12V DC, +12V DC), and also causes the characters which pass through it to be ECHOed (similar to "echo on" in modem-speak). This is not limiting however. ANY pin port can be used for RS-232 communication, and if proper RS-232 voltage levels are required by the external device, it is only necessary to add an RS-232 driver chip (ex. MAX232 or equivalent). Often this driver chip isn't even necessary, and one only needs to add a 22K ohm resistor in series with the RS-232 transmission line as current overload protection for the pin port, should something go wrong.

    I hope that clears things up some. It can be a bit confusing at first.

    Regards,

    Bruce Bates
  • kenobekenobe Posts: 7
    edited 2005-08-28 05:59
    Hi Bruce

    I understand now , thanks
Sign In or Register to comment.