2013-09-11 2 views
0

TCPIP, 직렬 포트 및 USB를 통해 터미널에 연결할 수있는 WinCE 응용 프로그램 (.Net 3.5)을 개발 중입니다.Windows CE 6.0은 USB 직렬 케이블을 통해 데이터를 전송합니다.

현재 USB 기능을 통합하려고합니다. 몇 가지 조사를 해본 결과 C#에서 SerialPort 클래스를 통해 USB 연결이 가능하다는 것을 알게되었습니다.

WinCE에 USB 직렬 케이블을 연결하려고 시도하고 새로운 COMort (COM5)가 나타납니다. 하지만 그 포트를 통해 데이터를 보내면 항상 Write Timeout 오류가 반환됩니다. 다음은

하여 SerialPort를 통해 내 코드를 연결하는 경우 :

private void SetSerialPort() 
{ 
    try 
    { 
     string[] a = SerialPort.GetPortNames(); 
     string port = "COM4"; 
     if (config.port.Length > 0) 
     { 
      port = config.port; 
     } 
     this.sp.PortName = port; 
     this.sp.BaudRate = 9600; 
     this.sp.DataBits = 8; 
     this.sp.Parity = Parity.None; 
     this.sp.StopBits = StopBits.One; 
     this.StartSerialPort(); 
    } 
    catch (Exception ex) 
    { 

    } 
    finally 
    { 
     this.Refresh(); 
    } 
} 
public void StartSerialPort() 
{ 
    try 
    { 
     this.sp.Open(); 
     this.sp.Handshake = Handshake.None; 
     this.sp.ReceivedBytesThreshold = 1; 
     this.sp.DiscardInBuffer(); 
     this.sp.DiscardOutBuffer(); 
     this.sp.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler); 
    } 
    catch (Exception ex) 
    { 
     throw ex; 
    } 
    finally 
    { 
     if (this.sp.IsOpen) 
     { 
      this.sp.RtsEnable = true; 
      this.sp.DtrEnable = true; 
      this.sp.WriteTimeout = 5000; 
     } 
    } 
} 

는이 설정을 통해 데이터를 보낼 수 있습니까? WinCE USB> USB-Serial (RS232)> DB9 핀.

고맙습니다.

답변

0

문제점을 발견했습니다. 내가 잘못된 케이블을 사용하고있는 것처럼 보입니다. 나의 케이블이 Prolific USB 칩셋을 기반으로하는 동안 내 WinCE Tablet은 FTDI 드라이버와 함께 설치됩니다. FTDI USB 칩셋 케이블을 구입했으며이 케이블에서 데이터를 수신 할 수 있습니다.

관련 문제