Shop OBEX P1 Docs P2 Docs Learn Events
send data from BS2 to the computer — Parallax Forums

send data from BS2 to the computer

student999student999 Posts: 9
edited 2008-03-01 00:37 in BASIC Stamp
Hi all

Iam using the BS2 to read from the SRF08 sensors, and I need to transfer the data (readings ) to computer using any of the ports. Can anybody tell me how to do that? and is necessary to transfer the data in a binary form through the I/O pins?


Thanks

Comments

  • sylvie369sylvie369 Posts: 1,622
    edited 2008-02-27 10:26
    If you read the help file for the SEROUT command, you'll find

    "All BASIC Stamps (except the BS1) have a line driver on its SOUT pin (Tpin = 16). See the "Hardware" section of the "Introduction to the BASIC Stamps" chapter. The SOUT pin goes to a PC's serial data-in pin on the DB-9 connector built into BASIC Stamp development boards. The connector is wired to allow both programming and run-time serial communication (unless you are using the Stamp 2 Carrier Board which is only designed for programming). For the built-in serial port set the Tpin argument to 16 in the SEROUT command".

    On the BS2 end, then, it's simply a matter of sending your data out through pin 16 using SEROUT. How you read the data on the other end depends on what kind of program you're using, of course. A simple way is to use a terminal program and capture the data to a file. You can have that up and running in minutes.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-02-27 14:40
    Yes:

    MyBaud CON 16468
    MyValue VAR WORD

    SEROUT 16, MyBaud, [noparse][[/noparse]"Hello there", CR] -- will send data out the DB-9 connector

    SERIN 16, MyBaud, [noparse][[/noparse]DEC MyValue] -- Will put a decimal string encoded value into "MyValue" from the DB-9 connector.
  • student999student999 Posts: 9
    edited 2008-02-28 10:52
    Thanks for your help but the problem is I'm using a laptop that doesn't include serial port, it just has a USB ports.·Can the USB to 232 be used?
    ·
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-02-28 14:16
    Fair enough. In order to program the BS2, you're using some kind of USB to 232 converter. So, when you plug in the converter (or the USB cable to the BOE-USB) it 'becomes' in effect a COM port on your PC. And yes, the above program works with a USB to RS232 converter.

    That's why SEROUT 16, [noparse][[/noparse]"Hello!", CR] uses that number "16" in there -- that says, use the 'programming port' on the BS2. Which, since you've been able to program the BS2, you MUST have worked out all the USB to RS232 kinks and know that link works.
  • student999student999 Posts: 9
    edited 2008-02-28 16:14
    Thanks alot for all of you. I will try that.

    thanks again
  • r2d2_botr2d2_bot Posts: 23
    edited 2008-03-01 00:37
    student999

    ·· Another option you can look at is called PLX-DAQ.· You can find this on the Parallax website at:

    http://www.parallax.com/tabid/441/Default.aspx

    ·· Using SEROUT, this will allow you to plop data right into an Excel spreadsheet.

    [noparse][[/noparse]Tim]


    student999 said...
    Hi all

    Iam using the BS2 to read from the SRF08 sensors, and I need to transfer the data (readings ) to computer using any of the ports. Can anybody tell me how to do that? and is necessary to transfer the data in a binary form through the I/O pins?


    Thanks
Sign In or Register to comment.