Shop OBEX P1 Docs P2 Docs Learn Events
PC to BS2 communication. — Parallax Forums

PC to BS2 communication.

BorisBoris Posts: 81
edited 2004-10-15 15:26 in BASIC Stamp
I am building a·fault downloader· (BS2sx) that would connect to a serial port on an electronic device, send a command to that device, receive and then interpret the errors received.
Here is the problem, i do not currenly have access to that device and would like to simulate its error code output. I know what the error codes look like, but what·i need is to connect the basic stamp serial port to PCs serial port and then write some software on the PC that will send one of 10-15 pre-recorded text files to the serial port depending on the received command.
Basically:
Basic Stamp sends "cmd1"
PC replies "some pre recorded text 1"
Basic Stamp sends "cmd2"
PC replies "some pre recorded text 2"

etc...

Any idea how i can write such software?

Thank you,

Boris.

Post Edited (Boris) : 10/14/2004 5:56:45 PM GMT

Comments

  • Ken GraceyKen Gracey Posts: 7,386
    edited 2004-10-14 19:22
    Boris,

    Maybe there is an easy solution rather than writing a PC program.

    One idea is that you can use a second BASIC Stamp for this purpose. If you want it to have a terminal use an LCD or the debug window. Alternatively, if a lack of automation is acceptable from the PC replies then perhaps you could use the Stamp's debug terminal white pane to send the data back to the BASIC Stamp by typing it in the window. This is pretty easy with DEBUGIN and DEBUG or SERIN/SEROUT (your choice).

    Or, you could write a PC program (not my specialty) like you said.

    Ken Gracey
    Parallax, Inc.
  • BorisBoris Posts: 81
    edited 2004-10-14 19:39
    I am using an LCD screen and debug, serialin, serialout commands.Let me explain this in more detail. The "fault downloader" will be used to receive error codes from an HF Transceiver. The transceiver does not just send codes continuosly it needs to receive a request (command) over the serial port indicating which set of errors it needs to send (set number goes from 0 to 29). I am currently writing software for BasicStamp 2 to send the command, receive the errors, interpret them and output them on the LCD screen in a user readable format.

    Currently, in order to test and trouble shoot the PBasic program on the BS2sx, i use the serialin command and the debug window included·in parallax's software. So every time I run the code it sends the "request" command for specified set of errors, and i·have to sit there and type in the error message in the debug window as if the transceiver is sending it. Well that error message is 4-5 lines of text, and if i make a mistake i have to start over, because it could have messed up the format of the error code, and·BasicStamp will not be able to interpret it correctly. For example the basic stamp expects part of the error code to read: elm_poi:5, if i type ekm_poi:5, i have to reset the basic stamp and start the trouble shooting over.

    SO: what im trying to do is make the PC automatically send a certain chunk of text every time it receives the "request" command.

    Sorry to make this message so long, i hope people read the entire message [noparse]:)[/noparse]
  • stamptrolstamptrol Posts: 1,731
    edited 2004-10-14 23:09
    · Boris,

    ····· What programming language do you want to use on the PC?

    ·· I have some samples in QuickBasic which would show you how to use the techniques.

    ··· Also, you could just set up another Stamp to act as the device under test and store your error messages with the 'data' command. I can show you a few samples if it would help.

    · Cheers

    ·· Tom Sisk
  • BorisBoris Posts: 81
    edited 2004-10-15 13:20
    I am decent with Visual Basic 6, and i do not have a second basic stamp.
  • allanlane5allanlane5 Posts: 3,815
    edited 2004-10-15 13:24
    I can give you the low-level VB to BS2 stuff in the attachment.

    You'll have to create some strings in VB, then send those
    strings to the BS2.
  • BorisBoris Posts: 81
    edited 2004-10-15 15:26
    I found what i was looking for, a simple VB application to send/recieve from serial port.
    http://www.ubasics.com/adam/electronics/ha/software/software.shtml
Sign In or Register to comment.