dodgy serial communication
-
Hey, My prog is supposed to communicate with an external device with the serial port.I ve got some trouble trying to get it working...:confused: If I don t run the hyperterminal before using my software, the communication doesn t work.I ve tried to use overlapped and nonoverlapped communication.I ve tried to use a couple of activex controls and different classes.But it's still the same.Moreover, I am almost sure that my initializiation parameters are OK. Has somebody already had this kind of bug? What does the hyperterminal do that my prog doesn t? I tried to use a sniffer to find out what s going on in my communication, but everything looks find as well. If you have any ideas, please feel free to share ur thought.... I ve been trying to debug my softare for 2 weeks now... Thanks for ur precious help. sysy
-
Hey, My prog is supposed to communicate with an external device with the serial port.I ve got some trouble trying to get it working...:confused: If I don t run the hyperterminal before using my software, the communication doesn t work.I ve tried to use overlapped and nonoverlapped communication.I ve tried to use a couple of activex controls and different classes.But it's still the same.Moreover, I am almost sure that my initializiation parameters are OK. Has somebody already had this kind of bug? What does the hyperterminal do that my prog doesn t? I tried to use a sniffer to find out what s going on in my communication, but everything looks find as well. If you have any ideas, please feel free to share ur thought.... I ve been trying to debug my softare for 2 weeks now... Thanks for ur precious help. sysy
-
Hey, My prog is supposed to communicate with an external device with the serial port.I ve got some trouble trying to get it working...:confused: If I don t run the hyperterminal before using my software, the communication doesn t work.I ve tried to use overlapped and nonoverlapped communication.I ve tried to use a couple of activex controls and different classes.But it's still the same.Moreover, I am almost sure that my initializiation parameters are OK. Has somebody already had this kind of bug? What does the hyperterminal do that my prog doesn t? I tried to use a sniffer to find out what s going on in my communication, but everything looks find as well. If you have any ideas, please feel free to share ur thought.... I ve been trying to debug my softare for 2 weeks now... Thanks for ur precious help. sysy
Cable If hyperteminal works then it should be OK Data You are using a sniffer, have you tried using 2 PCs with your prog on #1 and hypertermial on #2? Or use 1 PC with two serial ports? CreateFile CreateFile can be used to send serial data, search MSDN for "Configuring a Communications Resource" try this and send a test string to another PC that has hypertermial running, e.g. send "hello world". This should prove out your line settings baud rate, stop bits, parity etc. I assume this is where you problem is. With serial comms I always found is easiest to buy a comms library, the last one I used was COMM-DRV. Generally the problems are caused by the cable, handshaking, or not setting the
DCB
block inSetCommState
A favourite problem is using XON/XOFF protocol and sending XOFF, also some devices/computers will conver a LF to CR/LF unless line characteristics are set to raw mode. So do a simple test to prove it works sending to hypertermial, that will elinate the receiving prog/device.
It is amazing what you can accomplish if you do not care who gets the credit. - Harry S Truman
-
Hey, My prog is supposed to communicate with an external device with the serial port.I ve got some trouble trying to get it working...:confused: If I don t run the hyperterminal before using my software, the communication doesn t work.I ve tried to use overlapped and nonoverlapped communication.I ve tried to use a couple of activex controls and different classes.But it's still the same.Moreover, I am almost sure that my initializiation parameters are OK. Has somebody already had this kind of bug? What does the hyperterminal do that my prog doesn t? I tried to use a sniffer to find out what s going on in my communication, but everything looks find as well. If you have any ideas, please feel free to share ur thought.... I ve been trying to debug my softare for 2 weeks now... Thanks for ur precious help. sysy
Hi, you can try to use the MSCOMM32.OCX for that. Otherwise you can find a serial class here: http://www.naughter.com Regards Mark