Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
plz tell me how to communicate a realy using serial com port in mfc
Posted
Comments
TweakBird 22-Feb-11 0:11am    
Did you tried in google with keyword "serial com port in mfc"
tabassum malik 22-Feb-11 4:37am    
YES ,BT I CANT FIND THE CODE

 
Share this answer
 
Comments
JF2015 22-Feb-11 0:17am    
Good links although this once agains shows how lazy the OP'S are in finding the answers on their own. 5+
Hey just tries google on this you gets lots
one of method i used for opening SerialPort.

Don't forgot try catch block.
try {
    CSerialPort port;
    port.Open(1, 1200, CSerialPort::NoParity, 8, 
      CSerialPort::OneStopBit, 
      CSerialPort::XonXoffFlowControl);
    char sBuf[] = "This should appear on the serial port";
    port.Write(sBuf, strlen(sBuf));
    port.Flush();
    port.Close();
}
catch (CSerialException* pEx)
{
    TRACE(_T("Handle Exception, Message:%s\n"), 
                      pEx->GetErrorMessage());
    pEx->Delete();
}
 
Share this answer
 
v2
Comments
TweakBird 22-Feb-11 0:17am    
Use <pre> tag for code blocks.
i can't understand..plz tell me..its urgent.......
 
Share this answer
 
Comments
[no name] 22-Feb-11 1:02am    
Can you give details about what you exactly want from serialport object do you want to sent data or more manupulation on data

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900