I want to learn how to send and receive data using the serial (com) port on my computer, but i don't know of any tutorials or anything, so if any of you know where to find tutorials or anything about that, can you please tell me?
I want to learn how to send and receive data using the serial (com) port on my computer, but i don't know of any tutorials or anything, so if any of you know where to find tutorials or anything about that, can you please tell me?
Below is a list of the most commonly used functions in doing COM programming (AFAIK), which you can look up on MSDN and/or Google:
HANDLE
CreateFile(...)
WriteFile(...)
ReadFile(...)
Now, to actually do the programming is up to you, and it also depends on if you want to do multithreading in it, or not. Read up on those, and you should be set (HANDLE is a variable type (like int, char, float, etc...), but it's still on MSDN).
You're assuming they're doing Windows programming... Though I would also echo the Google suggestion.
Quzah.
Hope is the first step on the road to disappointment.
MSDN Says that i can NOT use any reserved device names as a filename, e.g. COM3 (then one I will be programming on)...
I don't know if i understand this completely.
The filename for both WriteFile and ReadFile would be "COM#" (in quotes), where # is the com port you want to connect to.Originally Posted by kristoffer
So this means I can use it then...
Anyway, thanks for the help
In this context (serial comms) yes, you actually must use it.Originally Posted by kristoffer
Emmanuel Delahaye
"C is a sharp tool"
There is a really good book by Paul Bergsman called "Controlling the World With Your PC" that deals with PC serial communication. Lots of C, Pascal, and Basic coding examples.
Good Luck!
and incase you want to avoid windows.h you can always use this: http://www.seetron.com/c_tip2.htm
"I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe
http://www.Bloodware.net - Developing free software for the community.
Mark Nelson (a Cisco programmer) came out with a really great book on serial communications (with a focus on the Window environment). Lots of great code examples and plenty of solid theory, too. Highly recommended.I want to learn how to send and receive data using the serial (com) port on my computer, but i don't know of any tutorials or anything, so if any of you know where to find tutorials or anything about that, can you please tell me?
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }
I were unable to find this book on amazon. Tell me, does it also explains about usb ports programming?
"I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe
http://www.Bloodware.net - Developing free software for the community.
In windows, there are two ways of doing so.
1. use bioscom built-in function in <bios.h> provided by all standard compilers
2. there are 10 registers available for the purpose. u will have to control them. that is u will have to understand how the data transfer takes place and accordingly u will have to set/reset appropriate bits (DTR,DSR,etc) in those registers. theres a book "IBM PC CLONES" available in market, it can help u out.
I had handled project on PC-PC communication earlier using second method. I can provide u with code in case u need it.
bios.h is only usable in dos based compilers. Modern compilers do not have it and modern operating systems will not work with it as you can not take direct control of ports like that anymore.
Originally Posted by Sebastianihttp://www.amazon.com/exec/obidos/tg...glance&s=books?Originally Posted by Devil Panther
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
No, just serial ports....tell me, does it also explains about usb ports programming?
Code:#include <cmath> #include <complex> bool euler_flip(bool value) { return std::pow ( std::complex<float>(std::exp(1.0)), std::complex<float>(0, 1) * std::complex<float>(std::atan(1.0) *(1 << (value + 2))) ).real() < 0; }