|
-
July 20th, 2009, 11:37 AM
#1
Serial Communication using MSCOMM32
Hi, I'm using the Microsoft communications control v6 in my program to communicate from my computer to a remote device using an rs232 port. I have successfully managed to get incoming data and process it, but I am having problems sending data. Here's my current code:
COleVariant aVar;
OLECHAR aArray[270];
aArray[0]='A';
aArray[1]='B';
aArray[2]='C';
aArray[3]='!';
aArray[4]= 26;
aVar = aArray;
CommControl12.put_Output(aVar);
I am using visual studio 9, and MSComm is imported as an active X control. The program compiles and runs, but no data is sent (this was checked by sending data to another computer). Any help would be appreciated!
-
July 20th, 2009, 01:41 PM
#2
Re: Serial Communication using MSCOMM32
To check whether you really send or receive data, use PortMon program:
http://technet.microsoft.com/en-us/s.../bb896644.aspx
Using ActiveX control in C++ is most complicated way of serial communications. ActiveX controls are for VB programmers. Most C++ programmers prefer to work with COM ports using plain API:
http://msdn.microsoft.com/en-us/library/ms810467.aspx
There are also number of COM port wrappers like:
http://www.codeproject.com/KB/system/cserialport.aspx
http://www.codeproject.com/KB/system/serial.aspx
which are more convenient for C++ developer than ActiveX control.
-
July 21st, 2009, 01:54 PM
#3
Re: Serial Communication using MSCOMM32
Thanks for the links. I'm looking into using the wrapper classes. I was wondering though if anyone knows how to solve my original code problem; the use of the active x control is currently widely used in my program.
-
July 21st, 2009, 07:46 PM
#4
Re: Serial Communication using MSCOMM32
Problem solved. We were using the wrong type of modem cable.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|