Society of Robots - Robot Forum
Software => Software => Topic started by: hazzer123 on April 23, 2007, 01:37:37 PM
-
I need to be able to quickly write some code that can write 2 bytes to the COM1 port and then wait to receive 2 bytes back. I dont need any fancy GUI, just the windows console is fine.
Do any of you have any source code you could let me see? Or any recommendations for software?
I have used Hyperterminal so far, but i need to perform maths calculations on the incoming bytes, and so need to write it myself.
My programming knowledge is mainly c++ but basic will also do.
Thankyou
-
do you need to test the com 1 port?
if so do a loopback test
-
Nope, i am communicating with a PIC. I am sending it a byte for the speed of the motor it is controlling, and a byte for the direction.
Then, when the PIC gets interrupted, the PIC sends out 2 bytes which are the total number of steps performed.
These are what i need to use in my calculations.
I have the whole thing setup, I just want to embed the communication into my app.
Thanks
-
Here you have a nice tutorial about serial port programming in windows enviroment: http://www.robbayer.com/files//serial-win.pdf (http://www.robbayer.com/files//serial-win.pdf).
-
And some example class that uses above stuff: http://www.bbdsoft.com/win32.html (http://www.bbdsoft.com/win32.html) (com port).
-
but i need to perform maths calculations on the incoming bytes, and so need to write it myself.
im guessing no, but does it need to be a realtime calculation? i always save my hyperterminal data as a .csv and postprocess it in excel . . .
-
How do you directly save hyperterminal data to csv?
Thanks
-
Hey its ok i managed to do i tusing the tutorials posted, they were fantastic!
BTW, the calculations were not needed real time, so it was easy.
Thanks for your replies
-
I perfer to do my postprocessing outside of the microcontroller to improve decimal accuracy and processing speed.
How do you directly save hyperterminal data to csv?
first, make sure you output data with either a tab or comma to space it
then in hyperterminal, click Transfer -> Capture Text
save the data however you want. you can also save it as a .txt file, then just rename the file to .csv
in excel, you need to reorder everything to be comma/tab delimited