Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. IT & Infrastructure
  4. Serial communication with Win32 API

Serial communication with Win32 API

Scheduled Pinned Locked Moved IT & Infrastructure
helpquestionalgorithmsjson
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rico Salfer
    wrote on last edited by
    #1

    Hello, I'm a software developer and have following problem with Win32 API and serial communication : In my protocol is a read thread to receive bytes. The function ReadFile() reads one Byte from serial interface (COM1 or COM2). I use an overlapped structure to receive data. If there is an error the function WaitForSingleObject() is called. Usually the receive is correct. Sometimes the function ReadFile() don't read a Byte although the InQueue has a byte. The function WaitForSingleObject() is called. This function returns with WAIT_TIMEOUT, the current Byte is lost. If I call in this case PurgeComm(), the lost Byte is in the buffer which was in ReadFile() the input buffer. But this algorithm don't works correct every time. How can I read the Byte in the InQueue if this byte can't read from a Win32 API function ? How can I avoid this problem ? Rico Salfer

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups