Shop OBEX P1 Docs P2 Docs Learn Events
Bi-directional comms BS2 & VB6 anyone? — Parallax Forums

Bi-directional comms BS2 & VB6 anyone?

4 yrs later4 yrs later Posts: 14
edited 2007-03-20 14:20 in BASIC Stamp
I resumed working on a project that I left off on 4 years ago - ANd I've searched the archives to see if anyone has come up with anything new on the topic, but w/o success. Perhaps I've missed something.
I have a 3 axis machine that I thought i could control w/ a PC, via a BS2 serial interface.
Using VB6's MSComm OnComm is fairly straightforward, but I'm having trouble with the PC seeing it's own serial output.
The board I made (years ago) supports the stamp and stepper drivers, but has it's com port set up exactly as a BS2 carrier board'srogramming connector.
I'm guessing that when the PC sends data into the Sin pin, an OnComm event is read through the 4.7K resistor and out via Sout pin. Since this winds up in the receive buffer, the VB code thinks it's an error, not seeing the handshake byte it expects.
Has anyone actually done a similar bi-directional comm project that worked out well, or am I just rusty on my VB?

Comments

  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-02-25 15:32
    StampPlot uses bi-directional comms, and the way I got away with it is to append something to the end of the outgoing string that the Stamp will ignore, echo back, and since it's so odd, the VB6 code sees it and know's it can't be good data.

    Data to Stamp - 150|Q| + CR
    On reception, VB2 sees |Q| in the string and dumps it the string.

    Note, StampPlot uses an ASCII 13 for a delimiter, so if it sees a string ending in |Q| it knows to ignore it and wait for the next string.

    After 6(?) years of doing everything under the sun with StampPlot, it's never come up as an issue.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • 4 yrs later4 yrs later Posts: 14
    edited 2007-02-25 16:10
    Thanks Martin.·StampPlot·is *VERY* interesting! Why·am I not familiar with it?·It may solve several things at once for me..hmmm...
    Tell me, do you think it's possible to generate a plot of a shape to scale and then send the points to the stamp one by one - of course with a reply from the stamp after the machine has reached each point?
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-02-25 16:50
    Actually, I don't think StampPlot would be a best fit for this as it would cumbersome to make work. Within a week or two an update to StampDAQ will be released (which will have a name change) which is an interface using VBA and Excel. The new version will provide the ability to read/write any cell in a spread sheet.

    So, you could lay it out, use Excel graphing to see it visually, then have the BASIC Stamp read each consecutive cell as it performs that move. Just work your way down the column. Sound like a good fit?

    As far as the echo issue, it uses directives at the start of each command sent to it (such as CELL,GET,A2), so when the value is echoed back, if it doesn't have a leading directive, it will not be used.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies

    Post Edited (Martin Hebel) : 2/25/2007 6:00:48 PM GMT
  • 4 yrs later4 yrs later Posts: 14
    edited 2007-02-26 11:49
    Sound like a good fit?

    Sure does. I don't need a major GUI production, and the ability to calculate shapes with Excel is actually a pretty good idea. At some point, however, I'll want to be able to generate coordinates from a graphics file - ultimately an export of a 2D ACAD file or some such...

    I started watching the port with my BitScope - and am surprised at what I'm seeing. While I can see data sent by either device (I am guessing this is due to pins 1 & 2 being tied together through the resistor on the BS2) on the same channel, at times i see nothing, other times I see multiple bursts. I'm not sure if I am dealing with an error in my VB, or if it's the way the API responds....

    I will keep watching for the StampDAQ update - you will announce it's release, right?

    Thanks once more,
    -Chris
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-03-20 14:20
    I see Parallax has released PLX-DAQ, the follow-up to StampDAQ.
    http://www.parallax.com/html_pages/downloads/software/software_plxdaq.asp

    -Martin


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters
    Southern Illinois University Carbondale, Electronic Systems Technologies
Sign In or Register to comment.