Bill Chennault
11-24-2006, 01:39 AM
All--
All of my robot and many of my automation ideas include a PC controlling a Stamp. Despite asking in many ways and reading many threads and doing a lot of Internet searches, I could not find out how to do this seemingly simple task.
Perhaps, it is SO simple that everyone can do it and it is not worth mentioning. If so, forgive me . . . but when I did it I was sure excited!
The Stamp (in my case, the BS2pX), simply needs to be set up to listen to PIN 16, which forces it to use Sin for serial communications to your PC (or whatever). (Usually, Sin is used by Stamp's DEBUG.)
So, I wrote a program that used SERIN to listen for one of three ASCII characters, A, B, or C. "A" turns on an LED. "B" turns it off. "C" makes it blink 10 times.
On the PC side all you need is an MSCOMM control set to 9600,n,8,1. Then, send an "A", "B", or "C".
The code is almost too dumb to post. The hard part was getting straight in my head what the Stamp was supposed to do (in this case, just listen and react appropriately) and what the PC was supposed to do (in this case, I explained it above . . . just be read to send the appropriate character).
If you use the PC to open the serial port BEFORE the stamp does, when the Stamp is powered up and the program launched, you will get a "Stamp not found" type error message. So, just power the Stamp up first and run the Stamp program before running the PC program. By the way, I did this via USB which inserted itself on COM6.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
All of my robot and many of my automation ideas include a PC controlling a Stamp. Despite asking in many ways and reading many threads and doing a lot of Internet searches, I could not find out how to do this seemingly simple task.
Perhaps, it is SO simple that everyone can do it and it is not worth mentioning. If so, forgive me . . . but when I did it I was sure excited!
The Stamp (in my case, the BS2pX), simply needs to be set up to listen to PIN 16, which forces it to use Sin for serial communications to your PC (or whatever). (Usually, Sin is used by Stamp's DEBUG.)
So, I wrote a program that used SERIN to listen for one of three ASCII characters, A, B, or C. "A" turns on an LED. "B" turns it off. "C" makes it blink 10 times.
On the PC side all you need is an MSCOMM control set to 9600,n,8,1. Then, send an "A", "B", or "C".
The code is almost too dumb to post. The hard part was getting straight in my head what the Stamp was supposed to do (in this case, just listen and react appropriately) and what the PC was supposed to do (in this case, I explained it above . . . just be read to send the appropriate character).
If you use the PC to open the serial port BEFORE the stamp does, when the Stamp is powered up and the program launched, you will get a "Stamp not found" type error message. So, just power the Stamp up first and run the Stamp program before running the PC program. By the way, I did this via USB which inserted itself on COM6.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.