串口通信的有几种实现的方法?请各位大虾指导下。。

解决方案 »

  1.   

    可以用控件来实现
    还可以用API函数来创建~
      

  2.   

    1,使用API createfile,writefile,readfile
    2.用控件mscomm
      

  3.   

    还可以利用VC++的标准通信函数_inp和_outp可实现串口通信。下面是一个串口初始化的程序:   void   init_com(PORT) 
    {char   i; 
    outp(PORT+3,0x80); 
    outp(PORT,0x0C); 
    outp(PORT+1,0); 
    outp(PORT+3   ,0x3a); 
    outp(PORT+3   ,0x03); 
    i=inp(PORT+5)   &&   0xfe; 
    outp(PORT+5,i);}   
      

  4.   

    SerialPort.cpp或mscomm.cpp都可以实现
      

  5.   

    www.codeproject.com上有CSerialPort类。
      

  6.   

    最好自己用API来做,用别人的类或多或少会有些问题
      

  7.   

    1,使用API createfile,writefile,readfile
    2.用控件mscomm
    3.www.codeproject.com上有CSerialPort类
      

  8.   

    楼主还是看看别人用API做的串口类吧,自己琢磨琢磨,就行了。
      

  9.   

    我用过个简单的http://blog.csdn.net/sunnyloves/archive/2010/05/10/5575995.aspx
      

  10.   

    1,使用API createfile,writefile,readfile
    2.用控件mscomm
    3.API