dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: How do i read digital data from serial Port

  1. #1
    Join Date
    Aug 2002
    Posts
    1

    Smile How do i read digital data from serial Port

    How do i read digital data from serial port
    & can display into chart

  2. #2
    Join Date
    Aug 2001
    Posts
    1,447
    ' COMM declarations
    Private Declare Function SetCommState Lib "kernel32" Alias "SetCommState" (ByVal hCommDev As Long, lpDCB As DCB) As Long
    Private Declare Function SetCommTimeouts Lib "kernel32" Alias "SetCommTimeouts" (ByVal hFile As Long, lpCommTimeouts As COMMTIMEOUTS) As Long
    Private Declare Function GetCommState Lib "kernel32" Alias "GetCommState" (ByVal nCid As Long, lpDCB As DCB) As Long
    Private Declare Function GetCommTimeouts Lib "kernel32" Alias "GetCommTimeouts" (ByVal hFile As Long, lpCommTimeouts As COMMTIMEOUTS) As Long
    Private Declare Function PurgeComm Lib "kernel32" Alias "PurgeComm" (ByVal hFile As Long, ByVal dwFlags As Long) As Long
    Private Declare Function BuildCommDCB Lib "kernel32" Alias "BuildCommDCBA" (ByVal lpDef As String, lpDCB As DCB) As Long
    Private Declare Function BuildCommDCBAndTimeouts Lib "kernel32" Alias "BuildCommDCBAndTimeoutsA" (ByVal lpDef As String, lpDCB As DCB, lpCommTimeouts As COMMTIMEOUTS) As Long
    Private Declare Function TransmitCommChar Lib "kernel32" Alias "TransmitCommChar" (ByVal nCid As Long, ByVal cChar As Byte) As Long
    Private Declare Function SetCommBreak Lib "kernel32" Alias "SetCommBreak" (ByVal nCid As Long) As Long
    Private Declare Function SetCommMask Lib "kernel32" Alias "SetCommMask" (ByVal hFile As Long, ByVal dwEvtMask As Long) As Long
    Private Declare Function ClearCommBreak Lib "kernel32" Alias "ClearCommBreak" (ByVal nCid As Long) As Long
    Private Declare Function ClearCommError Lib "kernel32" Alias "ClearCommError" (ByVal hFile As Long, lpErrors As Long, lpStat As COMSTAT) As Long
    Private Declare Function SetupComm Lib "kernel32" Alias "SetupComm" (ByVal hFile As Long, ByVal dwInQueue As Long, ByVal dwOutQueue As Long) As Long
    Private Declare Function EscapeCommFunction Lib "kernel32" Alias "EscapeCommFunction" (ByVal nCid As Long, ByVal nFunc As Long) As Long
    Private Declare Function GetCommMask Lib "kernel32" Alias "GetCommMask" (ByVal hFile As Long, lpEvtMask As Long) As Long
    Private Declare Function GetCommProperties Lib "kernel32" Alias "GetCommProperties" (ByVal hFile As Long, lpCommProp As COMMPROP) As Long
    Private Declare Function GetCommModemStatus Lib "kernel32" Alias "GetCommModemStatus" (ByVal hFile As Long, lpModemStat As Long) As Long
    Private Declare Function WaitCommEvent Lib "kernel32" Alias "WaitCommEvent" (ByVal hFile As Long, lpEvtMask As Long, lpOverlapped As OVERLAPPED) As Long
    phinds
    vs2008, 3.5SP1 Version 9.0.21022.8 RTM

  3. #3
    Join Date
    Apr 2002
    Posts
    174
    Also you can use the MsComm controll to handle the serial port, and get the incoming data. And the you can use MsChart (.. i think is no good control chart..) to chart the senquence of data read to the serial port.

    I hope i can help you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)