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#
  4. how to connect 9 pin serial port plug to itself so tha one can recive the data in the 2nd Pin andtransmit in 3rd pin

how to connect 9 pin serial port plug to itself so tha one can recive the data in the 2nd Pin andtransmit in 3rd pin

Scheduled Pinned Locked Moved C#
tutorial
11 Posts 5 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 pallaka

    how to connect 9 pin serial port plug to itself so tha one can recive the data in the 2nd Pin andtransmit in 3rd pin. I am not able to send or recive the data throuth 9 pin plug serial port.

    OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #2

    Connect pin 2 to pin 3, and unless there is some hardware handshaking, it should work. If handshaking is used, then connect 7 to 8, then 6 to 1 and 4 if required. See here for pinout[^]

    No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    P 1 Reply Last reply
    0
    • OriginalGriffO OriginalGriff

      Connect pin 2 to pin 3, and unless there is some hardware handshaking, it should work. If handshaking is used, then connect 7 to 8, then 6 to 1 and 4 if required. See here for pinout[^]

      No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

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

      I tried i am only able to recive but i am not able to write serial port.i mean i am not able tosend the data.Below is the code snip.

      if (serialPort1.IsOpen == false)
      {
      this.serialPort1.Open();
      }

               this.serialPort1.Write("3F 50 52 40");
      
      OriginalGriffO 1 Reply Last reply
      0
      • P pallaka

        I tried i am only able to recive but i am not able to write serial port.i mean i am not able tosend the data.Below is the code snip.

        if (serialPort1.IsOpen == false)
        {
        this.serialPort1.Open();
        }

                 this.serialPort1.Write("3F 50 52 40");
        
        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #4

        A couple of things: 1) Are you aware that

        serialPort1.Write("3F 50 52 40");

        will write 11 bytes, not 4? 2) Are you sure that you wired the connector the right way? The pin numbering is normally molded into the connector with a "1" beside pin one. If you are recieving ok, then you are presumably connected to something else as well, which would imply you have wired the connector wrong for loopback.

        No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        1 Reply Last reply
        0
        • P pallaka

          how to connect 9 pin serial port plug to itself so tha one can recive the data in the 2nd Pin andtransmit in 3rd pin. I am not able to send or recive the data throuth 9 pin plug serial port.

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #5

          Hi, if you need to test some serial port software, you can do so without requiring actual serial port hardware, by using virtual ports. Here[^] is an example for you; I used the com0com virtual driver successfully, it brings you a pair of virtual serial ports that seem connected by a null modem cable. :)

          Luc Pattyn

          :badger: :jig: :badger:

          Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.

          :jig: :badger: :jig:

          P 1 Reply Last reply
          0
          • L Luc Pattyn

            Hi, if you need to test some serial port software, you can do so without requiring actual serial port hardware, by using virtual ports. Here[^] is an example for you; I used the com0com virtual driver successfully, it brings you a pair of virtual serial ports that seem connected by a null modem cable. :)

            Luc Pattyn

            :badger: :jig: :badger:

            Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.

            :jig: :badger: :jig:

            P Offline
            P Offline
            pallaka
            wrote on last edited by
            #6

            After writing to the serial port i am reciving an error of writing timed out i am using the HandShake Requestto send,I am not geting the problem

            L M 2 Replies Last reply
            0
            • P pallaka

              After writing to the serial port i am reciving an error of writing timed out i am using the HandShake Requestto send,I am not geting the problem

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #7

              your statement isn't very clear; I think it tells me you are using hardware handshaking, and something is wrong with it. If the sender needs a permission to send, and the other party doesn't provide it, the sender is bound to time out (and if he were to ignore the lack of permission, the message would be lost as the other party will probably ignore it, being not ready to receive anything). You might try with a very simple communication: no handshaking, and short messages, far apart. When that works, add handshaking. When that works, use any message length and frequency you want. :)

              Luc Pattyn

              :badger: :jig: :badger:

              Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.

              :jig: :badger: :jig:

              D 1 Reply Last reply
              0
              • L Luc Pattyn

                your statement isn't very clear; I think it tells me you are using hardware handshaking, and something is wrong with it. If the sender needs a permission to send, and the other party doesn't provide it, the sender is bound to time out (and if he were to ignore the lack of permission, the message would be lost as the other party will probably ignore it, being not ready to receive anything). You might try with a very simple communication: no handshaking, and short messages, far apart. When that works, add handshaking. When that works, use any message length and frequency you want. :)

                Luc Pattyn

                :badger: :jig: :badger:

                Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.

                :jig: :badger: :jig:

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #8

                Judging by the timing of the messages, he isn't listening to anything anyone is saying. I think he's looking for a simple code fix and doesn't really have any hardware attched to the port at all, nor does he have the virtual COM ports you suggested installed.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008
                But no longer in 2009...

                L 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  Judging by the timing of the messages, he isn't listening to anything anyone is saying. I think he's looking for a simple code fix and doesn't really have any hardware attched to the port at all, nor does he have the virtual COM ports you suggested installed.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007, 2008
                  But no longer in 2009...

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #9

                  Dave Kreskowiak wrote:

                  he isn't listening to anything anyone is saying

                  Yeah. I have seen such pattern of behavior before, mostly in people from one and the same country. Writing is good, however I wish the would learn to read and interact too. :)

                  Luc Pattyn

                  :badger: :jig: :badger:

                  Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.

                  :jig: :badger: :jig:

                  1 Reply Last reply
                  0
                  • P pallaka

                    After writing to the serial port i am reciving an error of writing timed out i am using the HandShake Requestto send,I am not geting the problem

                    M Offline
                    M Offline
                    mustang86
                    wrote on last edited by
                    #10

                    Hi. As people have said, don't use hardware handshaking if you don't have to. It's harder to use hardware handshaking. But, it prevents buffer overruns. As people know, Windows is not a real-time OS. Hardware handshaking is much faster than using a higher level software implementation. In some cases, you can not tolerate a buffer overrun, and you want to use the fastest way you can. Serial communication is semi-slow to begin with. You'll need to make sure that the correct signals are connected in the cables. Most serial cables do not include the handshake signals! Also, you need to know the wiring of which pins on ConnectorA go to which pins on ConnectorB. I strongly recommend that you get and use an RS232 breakout box! It'll save you a lot of time. Also, you should have at least a light logic probe that can handle the RS232 voltage levels that you're using. You can use a DVM (Voltmeter). There are a number of low-cost USB "logic analyzers" that can interpret RS232 signals. The handshaking signals would often be displayed separately. I'm not sure if the MSOs show/decode the RS232 handshake signals. I like the Tek MSOs the best. This will help you get started with using RS232 handshaking: http://www.google.com/search?q=rs232+hardware+handshaking[^] http://www.google.com/search?q=rs232+breakout+box[^] Good Luck! ______________ Joe

                    M 1 Reply Last reply
                    0
                    • M mustang86

                      Hi. As people have said, don't use hardware handshaking if you don't have to. It's harder to use hardware handshaking. But, it prevents buffer overruns. As people know, Windows is not a real-time OS. Hardware handshaking is much faster than using a higher level software implementation. In some cases, you can not tolerate a buffer overrun, and you want to use the fastest way you can. Serial communication is semi-slow to begin with. You'll need to make sure that the correct signals are connected in the cables. Most serial cables do not include the handshake signals! Also, you need to know the wiring of which pins on ConnectorA go to which pins on ConnectorB. I strongly recommend that you get and use an RS232 breakout box! It'll save you a lot of time. Also, you should have at least a light logic probe that can handle the RS232 voltage levels that you're using. You can use a DVM (Voltmeter). There are a number of low-cost USB "logic analyzers" that can interpret RS232 signals. The handshaking signals would often be displayed separately. I'm not sure if the MSOs show/decode the RS232 handshake signals. I like the Tek MSOs the best. This will help you get started with using RS232 handshaking: http://www.google.com/search?q=rs232+hardware+handshaking[^] http://www.google.com/search?q=rs232+breakout+box[^] Good Luck! ______________ Joe

                      M Offline
                      M Offline
                      mustang86
                      wrote on last edited by
                      #11

                      I know that the OP isn't in America. Still, low-cost USB Logic Analyzers that support RS232 decoding, check out ebay: Business & Industrial > Electrical & Test Equipment > Test Equipment > Logic Analyzers http://business.shop.ebay.com/Logic-Analyzers-/97231/i.html[^] Here is the one that I use, and a number of other consultants use: http://www.pctestinstruments.com/[^] Note: The USB Logic Analyzers do not support doing a trigger on a specific data word. So, you would/could trigger the start bot of the RS232. The interpretation is done by post processing software. However, an MSO like the Teks, often support doing a trigger on a specific data word (e.g. trigger on RS232 data value of 0x43).

                      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