Need WinOS command line pgm -- can you help JonnyMac help a friend?
JonnyMac
Posts: 9,107
Another guy who uses the Propeller and works around movie and TV props asked me for help on a project -- and as I have focused all of my time on embedded programming I'm out of my depth when it comes to the PC side.
Here's what we need:
-- command line program called RUREADY.EXE
-- will take two parameters: com port and connection attempts, for example:
C:\ >RUREADY COM1 500
Behavior:
-- on running, open the com port and send "?" character at 57_600 baud
-- repeat every 20ms for number of attempts specified
* if no attempts specified, default to 100 (if this is not too much effort)
-- if "!" received, transmit "NOW!", wait 5 seconds then exit
The reason for waiting is in case the DTR line gets fiddled and resets the Propeller (we will be using a QuickStart connected to the PC -- it needs a second to do what it needs to do with its own IO.
The com port can simply be a number if that makes things easier.
I have CodeBlocks and MinGW on my computer but am just getting into it. My friend needs this quickly, as he is helping someone else.
Thanks for your consideration. If you can do it and provide a stand-alone executable I will be very grateful. I'll be especially grateful if I could open the code and re-compile it with CodeBlocks/MinGW so that I can learn from it. The last part is a nice-to-have, not have-to-have.
Thank you very much for your consideration.
Jon
Here's what we need:
-- command line program called RUREADY.EXE
-- will take two parameters: com port and connection attempts, for example:
C:\ >RUREADY COM1 500
Behavior:
-- on running, open the com port and send "?" character at 57_600 baud
-- repeat every 20ms for number of attempts specified
* if no attempts specified, default to 100 (if this is not too much effort)
-- if "!" received, transmit "NOW!", wait 5 seconds then exit
The reason for waiting is in case the DTR line gets fiddled and resets the Propeller (we will be using a QuickStart connected to the PC -- it needs a second to do what it needs to do with its own IO.
The com port can simply be a number if that makes things easier.
I have CodeBlocks and MinGW on my computer but am just getting into it. My friend needs this quickly, as he is helping someone else.
Thanks for your consideration. If you can do it and provide a stand-alone executable I will be very grateful. I'll be especially grateful if I could open the code and re-compile it with CodeBlocks/MinGW so that I can learn from it. The last part is a nice-to-have, not have-to-have.
Thank you very much for your consideration.
Jon
Comments
Will it be a Windows only application?
Usually DTR will toggle when all programs using the serial port are finished.
Added: Guess the thread title says it's Windows only. Doubt I could do today. So much "Honey, do this and that."
I actually got it working in Python -- muddled though, but made it work. Well, not with as much flexibility as I asked for, but I think that's fine. I fixed the COM port and attempts in the code. If this all happens, I will help my friend reassign the COM ports on his Propeller boards to match.
For you Python gurus, have a laugh at my expense. If there's an opportunity to teach me something, please take it!
Ooops, the initial version didn't send the '?' at startup. This latest one does.
-Phil
There is a certain amount of error trapping and the command line could be enhanced to accept more arguments or have some kind of "switch" system (-c -a etc.)
It also reports success or failure as it runs.
Jeff T.
EDIT I just realized the port is not closed when the app finishes, not a big deal for now if you want it I can re-post an update
@Phil: I had a little side bet in my head that you'd show me how to do this in Perl; which I find fascinating but not sure I'll ever tackle. I won that bet, think I'll treat myself to a beer!