Link to home
Start Free TrialLog in
Avatar of pigangel
pigangel

asked on

COM port programming

Hi,Experts:
   please help me urgently.
   I am doing the COM port programming the first time, I had got some articles with example coding for web e.g. codeguru. but I still don't understand completely about data receiveing.
I am doing the test program in order to understand the com port communication. the program including 2 modules, one is to send data, the other is to recieve data.
my program is :
 even I make the receive buffer much longer than the length of sent message, I always receive data piece by piece (e.g, I send 28 bytes data, the data  recieved is always 8 byte, 8 byte ....).
  Is com port transferring data like this way? what should I do so that I can get the whole piece message at one time. please kindly give me any idea, example coding will be very appreciated. thank you very much!

-- pigangel
Avatar of jkr
jkr
Flag of Germany image

The best article on serial programming IMHO is http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp ("Serial Communications in Win32")
Avatar of Mazen
Mazen

Hi,
Why don't you use a timer to get the data in buffer every 1 second.
I worked with the serial port alot but I used ActiveX for that.
If you are interested I can help you with the code for ActiveX.
Pleas post a comment if you want the code with ActiveX.

Regards

Mazen
Avatar of pigangel

ASKER

Hi,Mazen, can you please help me with the ActiveX, I am interested in trying any possible solution, thanks.

pigangel
Dear pigangel,

You can use your MSComm activeX control came with your visual studio.

You can customise it after adding the class to your project to send and receive data as bytes.

-cvallabhaneni
Hi,Mazen, can you please help me with the ActiveX, I am interested in trying any possible solution, thanks.

pigangel
thank you!cvallabhaneni,is this MSComm ActiveX same as that one to be used well in VB application? How to do so that I can add to my project?

-pigangel
Look for the VCTERM Sample in MSDN for the detailed explanation of how to use MSCOMM in VC++.

-chandu
ASKER CERTIFIED SOLUTION
Avatar of Chandra V
Chandra V

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,
Sorry it took me time  to reply.
check the following website for using ActiveX:

http://www.codeguru.com/mfc/comments/9565.shtml
Hope this helps

Regards

Mazen
Thanks a lot, all your comments are very helpful for me, so I understand it quite clearly.and finally I choose to use one clase from Codeproject.  I am sorry I can only one comment as answer. again,Thank you very much!

-- Pigangel