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. General Programming
  3. C / C++ / MFC
  4. Serial Port communication

Serial Port communication

Scheduled Pinned Locked Moved C / C++ / MFC
comhelptutorialquestion
4 Posts 2 Posters 0 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.
  • P Offline
    P Offline
    picazo
    wrote on last edited by
    #1

    Hi all, this is my first time using port communcation, so I am a bit confused. I have read the msdn and several articles, but I still don't understand exactly how to do what I want. Basically, I have a peripheral on my machine that I want to send messages to and receive messages from. I downloaded the CSerialCom[^] library from codeproject, so reading and writing is not a problem. The problem is that the system requires programatic-management of control flow mechanish (DTR/DSR), which means that I must assert the DTR to get the peripheral's attention, and then I must wait for the DSR assertion before I can transmit data. Can someone provide a demo that shows how to communicate with a peripheral with these contraints? Thanks, ----------------- Genaro

    B 1 Reply Last reply
    0
    • P picazo

      Hi all, this is my first time using port communcation, so I am a bit confused. I have read the msdn and several articles, but I still don't understand exactly how to do what I want. Basically, I have a peripheral on my machine that I want to send messages to and receive messages from. I downloaded the CSerialCom[^] library from codeproject, so reading and writing is not a problem. The problem is that the system requires programatic-management of control flow mechanish (DTR/DSR), which means that I must assert the DTR to get the peripheral's attention, and then I must wait for the DSR assertion before I can transmit data. Can someone provide a demo that shows how to communicate with a peripheral with these contraints? Thanks, ----------------- Genaro

      B Offline
      B Offline
      Branislav
      wrote on last edited by
      #2

      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/monitoring\_communications\_events.asp and http://www.codeproject.com/system/serial\_com.asp

      P 1 Reply Last reply
      0
      • B Branislav

        http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/monitoring\_communications\_events.asp and http://www.codeproject.com/system/serial\_com.asp

        P Offline
        P Offline
        picazo
        wrote on last edited by
        #3

        Thank you for your response. However, I still don't understand how to set the DTR high before monitoring for the DSR flag. Could you please explain that? Thank you, ----------------- Genaro

        B 1 Reply Last reply
        0
        • P picazo

          Thank you for your response. However, I still don't understand how to set the DTR high before monitoring for the DSR flag. Could you please explain that? Thank you, ----------------- Genaro

          B Offline
          B Offline
          Branislav
          wrote on last edited by
          #4

          I think that you have null modem connection. DTR -> DSR are continual signal. When you set DTR signal on high that means you are redy to send data but when your DSR become high that mean you can receive data from device. When you start to configure port set DTR signal with DTR_CONTROL_DISABLE and fDsrSensitivity in DCB with TRUE to avoid flow, but watch all changing are valid after calling function SetCommState. Now you can control DTR with function EscapeCommFunction and monitoring DSR. My recommmendation is whenever use EscapeCommFunction(hFile, CLRDTR | CLRRTS ) or EscapeCommFunction(hFile, SETDTR | SETRTS).

          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