Is it possible to write a programme to (detect)recongize the Basic Stamp Module
Will Kwok
Posts: 2
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.
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.
Comments
·
·· 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
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.
·
··· 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
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.