PC controlled BS2 (a non stand-alone controller)
cclaud2
Posts: 21
Hi,
Is there anyway to to control the BS2 with your PC so that you are not restrained by the amount of memory the BS2 has or the processor speed the BS2 runs at? I just want to be able to control all the I/Os on the BS2 while having the BS2 connected to my computer via its USB port. Does parallax sell anything like this?
The controller would never have to act as a stand alone controller.
Please help.
Is there anyway to to control the BS2 with your PC so that you are not restrained by the amount of memory the BS2 has or the processor speed the BS2 runs at? I just want to be able to control all the I/Os on the BS2 while having the BS2 connected to my computer via its USB port. Does parallax sell anything like this?
The controller would never have to act as a stand alone controller.
Please help.
Comments
D xxxx Set the direction for each port pin.
O xxxx Output to the port pins.
I xxxx Input from the port pins and send the data back to the PC.
Of course, the BASIC Stamp is capable of more than simple I/O. If you want pulsed output, audio output, etc., you can always create and interpret commands for those as well.
-Phil
Jeff T.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
-Phil
How does the following help with that?
D xxxx Set the direction for each port pin.
O xxxx Output to the port pins.
I xxxx Input from the port pins and send the data back to the PC.
All I see that this program would do is make a primitive user interface, not run any programs. Sorry to burst into the post like this, but isn't something (software) missing on the PC side?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (D Faust) : 8/12/2007 11:58:41 PM GMT
If you want I/O control, you COULD make a stamp respond to serial input from a PC program... but it's not really something you would do with the STAMP IDE it would be better accomplised as a separate program... like hyperterm.· But you still need good code in the STAMP to listen to it.· I take it that you don't want to write the code yourself.· This type of PC-microcontroller-I/O interface is common in robotics... I've seen websites selling items like this.
Hmmm. You might want something like a pbasic to run on the PC and drive real world I/O's that isn't necessarily the STAMP? Isn't that what the PC's parallel port can be used for if driven by Visual Basic or something similar? Like this, maybe: http://www.anthillsolutions.com/prim_en.html
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There's nothing like a new idea and a warm soldering iron.
Post Edited (pwillard) : 8/13/2007 12:03:19 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
From what you are saying you want to do it won't work.(simply anyway) Hope this helps.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
-Phil
So let's suppose you want to use your computer to run a program that monitors temperature and pressure of some system, and you want to connect the temperature and pressure sensors to a BS2. Since the BS2 will be handling the sensors, there has to be a program there to at least read the sensors. However, since the BS2 also needs to a) receive instructions from the PC, and b) send data to the PC, the PBasic program also need to be able to do this, too.
So this is 4 tasks for the BS2:
1. Get input from the PC
2. Get the temperature reading
3. Get the pressure reading
4. Send the data to the PC
Since we want to use the PC to request the current temperature or pressure readings, we'll create some kind of program that has 2 buttons called (you guessed it!) Get Temperature and Get Pressure. When either of these buttons is pressed, the application will do several things:
1. It will create a serial port connection to the BS2
2. It will send a "command" to the BS2 requesting the appropriate info
3. It will wait for and receive the info back from the BS2
4. It will close the serial port connection to the BS2
5. It will play a variety of musical tunes based on the temperature and pressure readings
Since there are only 2 buttons for this PC application, and since each has to send a "command" to the BS2, and since the BS2 is well suited to receiving bytes, we decide to send a "1" to get the temperature, and a "2" to get the pressure. This allows us to write a Pbasic program that looks something like this:
Since the Stamp is looking for a command from the PC, or doing something, we'll put it into a loop that gets input from the PC and then does something based on that input. In this case there are only 2 choices for BS2 - get the temperture reading and send the info to the PC or get the pressure reading and send the info to the PC.
Once the PC gets the info, it will play its' tunes based on the values it receives from the BS2. For example:
if TemperatureValue < 50 then play Song1
else
if TemperatureValue = 50 then play Song2
else
if TemperatureValue > 50 then play Song3
etc.
So all of this depends on a knowing which tasks to assign to the PC & BS2, creating the appropriate program for each. What Phil Pilgrim is describing here...
D xxxx Set the direction for each port pin.
O xxxx Output to the port pins.
I xxxx Input from the port pins and send the data back to the PC.
...is a basic communication protocol that he's suggesting between the PC and BS2. If I'm not mistaken, it's a format that he uses, so you'll have to ask him for samples of code in action. He did post a Perl application that had something similar, and the docs for that were fairly thorough. Again, he can give more info.
The PBasic code that I wrote above is adapted from a simple robot simulator that I was working on, built with a HomeWork board. Anybody interested in seeing a snippet from the PC side can see it here:
http://forums.parallax.com/showthread.php?p=663025
http://www.parallax.com/dl/docs/cols/nv/vol6/col/nv125.pdf
Might be close to what you want even though it's not a stamp emulator.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
There's nothing like a new idea and a warm soldering iron.