Shop OBEX P1 Docs P2 Docs Learn Events
Serial Port Communications — Parallax Forums

Serial Port Communications

Jason OJason O Posts: 16
edited 2007-08-29 15:37 in BASIC Stamp
Hello All,

I'm new to the BASIC Stamp scene. I just ordered an OEM BASIC Stamp 2 kit for a project I am working on. I heard that you can communicate to the computer through the serial port on the OEM board (not just to program it), and I was wondering if it is possible to send commands to the stamp from my computer (using the MsComm control in VB6) using only the hardware already on the OEM board. Or would I need a separate chip like one of the MAX chips? Are there any good tutorials out there explaining how to work with the serial port?

God Bless,
Jason O

Comments

  • QuattroRS4QuattroRS4 Posts: 916
    edited 2007-08-24 07:39
    Jason,
    In short the answer is yes you can communicate with your stamp via serial to a vb app as is ... However If you were to implement a 'proper' serial coms routine in a finished project I would use the likes of a max 232 ..

    Have a look at some samples ...· VB6, .NET and others ..
    http://forums.parallax.com/showthread.php?p=640960

    Regards,
    John Twomey

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    'Necessity is the mother of invention'
  • Jason OJason O Posts: 16
    edited 2007-08-29 13:02
    Hi,

    Thanks for the link. Though I am still a bit confused here. So, you are saying that I can use the MsComm control with the OEM board as is without the MAX chip? What do you mean by 'proper' communications?

    I've looked around a bit at some things and I noticed that some people had to write special controls that could directly access the pins on the serial port in order to communicate to a micro controller. Ideally, I would like to avoid anything like that so that I can just use the control in VB in the normal way and send and receive characters from my stamp

    God Bless,
    Jason O
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-08-29 13:20
    Yes you can. You use the "SERIN 16 ..." and "SEROUT 16 ..." commands -- SERIN to recieve data into the BS2 from the PC, and SEROUT to send data from the BS2 to the PC.

    The BS2 saved money (and space, and complexity) on their programming port, by using the TX line from the PC into the BS2 as the voltage source for signals sent back to the PC on the RX line. This lets them implement the RS-232 TX/RX circuit using only two transistors, instead of the more costly and bulky 1488 and 1489 chips and more importantly a +12 and -12 volt supply. Nowadays the MAX232 uses a chip and 4 capacitors for that -- but that's STILL kind of bulky.

    The result of this is that anything sent to the BS2 on the TX lines is echoe'ed by the hardware back on the RX line to the PC. This means your PC program has to be aware, and able to 'toss' the echo'ed characters. This usually is a very small issue, but you must be aware of it.
  • pwillardpwillard Posts: 321
    edited 2007-08-29 15:37
    The thing is... it's up to you.

    This has been an on going discussion/issue I guess with people asking this question quite a few times lately. Serin/Serout work on any port.

    The BS2-Debugging/programming interface is not quite but almost·RS232.

    1) It echoes.· Not changeable.
    2) Does not conform to RS232 voltage level specifications (which is why we mention the MAX chip).

    At issue:· Distance for reliable RS232 communication is dramatically reduced. (I've used RS232 at 9600 baud to just under 5000 ft)

    I realize you have that D-SUB9 connector on the board staring at you and·saying "YOU MUST USE ME!", but you could opt for a·pre-built SCHMARTBOARD (MAX232 based) RS232 module for $14.95 and get the right interface levels without much work and just a few wire jumpers.

    Of course, if you don't care and will only go a few·feet with your connections...· you·only need to create a simple cable and deal with issue #1·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    There's nothing like a new idea and a warm soldering iron.
Sign In or Register to comment.