Microsoft Developer Network > 포럼 홈 > Visual C++ Language > Com Port connection using USB in C++
질문하기질문하기
 

답변됨Com Port connection using USB in C++

  • 2008년 7월 28일 월요일 오전 3:10intip 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Hi,

    I am a new coder in Visual C++. I have coded in Visual basic and am familiar with the concepts of object orientated programming. I am having some problems opening a com port using C++ through a USB device. The Com port is created and exists in the Control Panel under modem. The specification are there as well.

    The question, is there a class that i can use to create a connection to this COM port to the device? Can anyone provide me with some sample code for creating a com port connection through USB in C++?

    Any assistance will be appreciated.

    Regards
    Dal

답변

  • 2008년 7월 28일 월요일 오후 1:13l00p1n6 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    Hi Del,

    Comport connection creation through USB is done using regular comports. You have to install drivers provided with serial/usb cable (or download one). Then you can check for COM  port number under Ports (COM and LPT) in Device Manager. (tip: unplug cable and plug it in again to be sure you got the right com port number). 
    Then you can try connecting by using this "library", for example:
    http://www.codeproject.com/KB/system/serial.aspx?display=PrintAll&fid=1996&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=226&select=1241634

    If you have some problems with COM ports greater than 9 (two digits) try to manually set COM port number to 1-9.

    Regards
    Kresimir
    • 답변으로 제안됨l00p1n6 2008년 7월 28일 월요일 오후 1:14
    • 답변으로 표시됨Yan-Fei Wei 2008년 8월 3일 일요일 오후 2:31
    •  

모든 응답

  • 2008년 7월 28일 월요일 오후 1:13l00p1n6 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     답변됨
    Hi Del,

    Comport connection creation through USB is done using regular comports. You have to install drivers provided with serial/usb cable (or download one). Then you can check for COM  port number under Ports (COM and LPT) in Device Manager. (tip: unplug cable and plug it in again to be sure you got the right com port number). 
    Then you can try connecting by using this "library", for example:
    http://www.codeproject.com/KB/system/serial.aspx?display=PrintAll&fid=1996&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=226&select=1241634

    If you have some problems with COM ports greater than 9 (two digits) try to manually set COM port number to 1-9.

    Regards
    Kresimir
    • 답변으로 제안됨l00p1n6 2008년 7월 28일 월요일 오후 1:14
    • 답변으로 표시됨Yan-Fei Wei 2008년 8월 3일 일요일 오후 2:31
    •  
  • 2008년 8월 4일 월요일 오전 5:08intip 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Hi Kresimir,

    Thank you for your answer. I will take a look a the link that you provided.

    Regards,
    Dal