add usb, and control with C++ in real time
Crossfire_softwarez
Posts: 3
OK kinda new to the parallax family chips...
right now i have a stamp II kit, serial programmed.
i want it to be connected to USB, controlled through C++, but i want it done in real time, not program the stamp and run the program...
the reason, the stamp doesnt hold the amount of programming needed, and it also doesnt store the amount of variables needed...
and it needs to be controlled from ANY systme it is plugged into, not just one with serial, seeing most computers including my 3 main laptops dont have serial ports, just usb...
anyone have any ideas?
right now i have a stamp II kit, serial programmed.
i want it to be connected to USB, controlled through C++, but i want it done in real time, not program the stamp and run the program...
the reason, the stamp doesnt hold the amount of programming needed, and it also doesnt store the amount of variables needed...
and it needs to be controlled from ANY systme it is plugged into, not just one with serial, seeing most computers including my 3 main laptops dont have serial ports, just usb...
anyone have any ideas?
Comments
You can get any of a variety of USB to serial adapters and use that for the serial connection to the PC. Not all USB to serial adapters will work for programming, but most will work to otherwise send data back and forth to the PC. I suggest Parallax's USB to RS232 serial adapter. It's small, cheap, and reliable ... and you can use it to program the Stamp.
You can't directly control the Stamp from the PC. There has to be a program running on the Stamp and it's what's controlling the I/O pins. That said, it can be a simple program that just continually waits for bytes to be sent from the PC and outputs those bytes to the I/O pins or reads the state of I/O pins and sends that data to the PC. There's no specific format for that data. It's just arbitrary bytes as far as the Stamp is concerned. You'll need to set up your C++ program to interpret what the Stamp sends and to send appropriately formatted data to the Stamp. You'll also have to write a short program on the Stamp side to do the work there.
Have a look at the StampPlot Pro program which can be found on Parallax's Stamp Downloads webpage. This shows what can be done along these lines.
dont think i have a prob with writing a "transfer" program on the stamp...
thinking i can get away from programming the chip, if i can send, for example
turn on 0,1,2,3,4,5,6,7
turn on 8
turn off 8
turn on 0,1,2,3
turn off 4,5,6,7
turn on 9
turn off 9
this will "program" the chip, run it, then stop
then when i want to send "new" data, have it program it again
in the example, 0-7 are my "data" i am sending
pins 8 and 9 are the "triggers" for my flip flops...
but i kinda need c++ to be able to send the "program" to the chip, that way it is computer controlled, and the variable can be stored
hope this clarifys the question...
i could use serial to send data that the stamp could "decode"
preprogrammed stamp to take the input, like 1-320, and "toggle" the resulting bits....
just need to know how to program stamp to decode the input from the serial....
The Stamp would execute: DEBUGIN WAIT("!!"), turnOn.BYTE0, turnOn.BYTE1, turnOff.BYTE0, turnOff.BYTE1
This would read 5 bytes from the PC via the serial/USB connection. The first two are just for synchronization.
This would have the Stamp wait until it receives the "!!", then it would receive 4 more bytes and store the
first 2 in one 16-bit variable and the second 2 in another 16-bit variable. You'd then turn the I/O pins on and off
with: OUTS = (OUTS & !turnOff) | turnOn. The I/O pins would need to be configured as outputs (rather than inputs).
Look at the Stamp Manual (Basic Stamp Syntax and Reference Manual) for details on OUTS and DIRS.
Because of the way the serial connection is wired on the Stamp, the characters sent from the PC would be echoed
back to the PC (and would have to be ignored).