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. Need help regarding serial Communication Programming

Need help regarding serial Communication Programming

Scheduled Pinned Locked Moved C / C++ / MFC
help
9 Posts 4 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.
  • Y Offline
    Y Offline
    yaminisridaran
    wrote on last edited by
    #1

    I have to check whether the CTS signal and RTS Signal in serial port. I have modified my dcb.fOutxCtsFlow=TRUE; dcb.fRtsControl=RTS_CONTROL_ENABLE; I am placing a LED between pin7(RTS) and pin5 for GND to check whether voltage occurs in that pin7. But no voltage occurs. S.Yamini

    H H N 3 Replies Last reply
    0
    • Y yaminisridaran

      I have to check whether the CTS signal and RTS Signal in serial port. I have modified my dcb.fOutxCtsFlow=TRUE; dcb.fRtsControl=RTS_CONTROL_ENABLE; I am placing a LED between pin7(RTS) and pin5 for GND to check whether voltage occurs in that pin7. But no voltage occurs. S.Yamini

      H Offline
      H Offline
      hameduser
      wrote on last edited by
      #2

      what is your OS? if your OS is windows XP/2003 or later , you can work with com/parallel port directly, because this ports close by Microsoft, you can use API for this work. successful

      Y 1 Reply Last reply
      0
      • Y yaminisridaran

        I have to check whether the CTS signal and RTS Signal in serial port. I have modified my dcb.fOutxCtsFlow=TRUE; dcb.fRtsControl=RTS_CONTROL_ENABLE; I am placing a LED between pin7(RTS) and pin5 for GND to check whether voltage occurs in that pin7. But no voltage occurs. S.Yamini

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        See Serial library for C++[^] does helpful?


        WhiteSky


        1 Reply Last reply
        0
        • H hameduser

          what is your OS? if your OS is windows XP/2003 or later , you can work with com/parallel port directly, because this ports close by Microsoft, you can use API for this work. successful

          Y Offline
          Y Offline
          yaminisridaran
          wrote on last edited by
          #4

          My OS is Windows Xp. Can u tell me which API I can use S.Yamini

          1 Reply Last reply
          0
          • Y yaminisridaran

            I have to check whether the CTS signal and RTS Signal in serial port. I have modified my dcb.fOutxCtsFlow=TRUE; dcb.fRtsControl=RTS_CONTROL_ENABLE; I am placing a LED between pin7(RTS) and pin5 for GND to check whether voltage occurs in that pin7. But no voltage occurs. S.Yamini

            N Offline
            N Offline
            normanS
            wrote on last edited by
            #5

            Please give more details. I think you need to: 1. Open the serial port (CreateFile) 2. Get the state of the DCB (GetCommState) 3. Set dcb.fOutxCtsFlow and dcb.fRtsControl 4. Set the state of the DCB (SetCommState) Are you doing all of these?

            Y 1 Reply Last reply
            0
            • N normanS

              Please give more details. I think you need to: 1. Open the serial port (CreateFile) 2. Get the state of the DCB (GetCommState) 3. Set dcb.fOutxCtsFlow and dcb.fRtsControl 4. Set the state of the DCB (SetCommState) Are you doing all of these?

              Y Offline
              Y Offline
              yaminisridaran
              wrote on last edited by
              #6

              I am sorry I have Placed my question wrong. I have to control a relay using serial port .The RTS and DTR should become high so that I control my relay. S.Yamini

              N 1 Reply Last reply
              0
              • Y yaminisridaran

                I am sorry I have Placed my question wrong. I have to control a relay using serial port .The RTS and DTR should become high so that I control my relay. S.Yamini

                N Offline
                N Offline
                normanS
                wrote on last edited by
                #7

                I meant, we need more details about what you are doing in your program - a longer code section, maybe. Once you set the parameters in the DCB, did you do: SetCommState(hPort, &dcb);

                Y 1 Reply Last reply
                0
                • N normanS

                  I meant, we need more details about what you are doing in your program - a longer code section, maybe. Once you set the parameters in the DCB, did you do: SetCommState(hPort, &dcb);

                  Y Offline
                  Y Offline
                  yaminisridaran
                  wrote on last edited by
                  #8

                  I am trying to control a relay via serial port using RTS and DTR pins in serial port . I have set these two pins high via VC++ coding or C. Can we suggest me something. S.Yamini

                  N 1 Reply Last reply
                  0
                  • Y yaminisridaran

                    I am trying to control a relay via serial port using RTS and DTR pins in serial port . I have set these two pins high via VC++ coding or C. Can we suggest me something. S.Yamini

                    N Offline
                    N Offline
                    normanS
                    wrote on last edited by
                    #9

                    It's difficult to help if you don't show what you are doing already. Maybe you are missing a step in your program, so the lines are not actually going high. If you are setting the pins high, maybe they can not supply enough current to turn on a relay. Instead of using the control lines, what about using lines on a parallel port? Have a look at this article www.codeproject.com/useritems/PaPiC.asp[^] - it uses the InpOut32 library, which allows direct access to I/O ports.

                    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