Shop OBEX P1 Docs P2 Docs Learn Events
Is it possible to write a programme to (detect)recongize the Basic Stamp Module — Parallax Forums

Is it possible to write a programme to (detect)recongize the Basic Stamp Module

Will KwokWill Kwok Posts: 2
edited 2007-01-04 20:08 in BASIC Stamp
Hi All,

I am writing a program capture signal detected by the Basic Stamp module
However, the number of serial port is vary in different computer and thus I would like to write a program to scan the basic stamp automatically ( like the BS editor )
But I have no idea about it.

Thx. smile.gif

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-03 22:07
    Will,
    ·
    ·· You can detect a BASIC Stamp connected to a PC by checking for the loop-back on the Serial Port (DSR/RTS) and echo on the TX/RX lines.· Optionally you could have the stamp sending its data to the PC and monitor the port for the data (specifically a header).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • AImanAIman Posts: 531
    edited 2007-01-04 14:20
    ·
    Optionally you could have the stamp sending its data to the PC and monitor the port for the data (specifically a header).
    



    How can that happen?

    I would like to do just that but have problems with it. There is an excel sheet I found that pulls a 1 or 0 for each pin but nothing I have found that allows a PC to read the Stamps data.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-01-04 16:28
    Okay,
    ·
    ··· So your BASIC Stamp is getting information and sending to the PC.· This can happen whether the PC is listening or not.· With multiple BASIC Stamps collecting data going to the PC you could prefix each packet of data with a header such as:
    ·
    !BSnn:xxxxxxxxxxxx
    ·
    …where nn is the module number and the xxxxxxx is the data being sent.· A PC application monitoring all serial ports could look for the loopback, but if that wasn’t available it could simply look for incoming characters “!BS” and determine a BASIC Stamp sending data is connected.· The next 2 digits are the ID so it can distinguish multiple units.· Just an idea but it could work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • allanlane5allanlane5 Posts: 3,815
    edited 2007-01-04 20:08
    You write a program for your PC that sends out each serial port, the string "H?".

    You then write a program for your BS2 that every so often checks the serial port for two bytes. If it gets the two bytes "H?", then you have the BS2 send back "Yes".

    Your PC program, having sent "H?", then waits a little while for the BS2 to respond with "Yes". No response means that port is not being monitored by a BS2.

    Now, to make this a little more robust, probably you want to send that "H?" a few times -- since unless the BS2 is 'waiting' in a SERIN statement, it won't get the data.

    Another alternative is to 'set' the RTS signal from your PC, then from your PC read the state of the DSR pin. If a BOE is connected to that port, the RTS pin is looped back to the DSR pin. This way, you won't be depending on the BS2 being in some state.

    You can also pull the DTR signal high briefly if you want to 'reset' the BS2 back to the start.
Sign In or Register to comment.