Announcement

Collapse
No announcement yet.

Implementing RS 232 communication

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts


  • #16
    Originally posted by FEContractor View Post
    OK, my next question. I have messages I send to the PLC and I am using Custom Protocol In to receive these messages. I am only seeing the first message to be received. If I send a second message, the PLC isn't detecting it.

    I have the Custom Protocol In set to variable length with 2 characters as the termination code for the message. The max length is set larger than either message being sent in. I am monitoring the communication Booleans and see InProcess is set initially but then is unset after the first message is received. Complete and Success are set after receiving this message. I clear both of these flags after processing the received message and still not getting the second message. I alos tried setting InProcess again once the message was processed but still not getting the second message.

    So what am I missing to enable the RS232 to receive another message?
    Is the instruction to receive in on at all times?

    Watch this video:
    https://www.automationdirect.com/vid...cat2=7&cat3=10

    It will be slightly different because you are doing custom protocol instead of straight ascii, but much of it will be similar
    Last edited by MikeN; 12-11-2018, 09:45 AM.

    Comment



    • #17
      I looked at the video, I don't understand the question about the instruction to receive in on at all times. I have the Custom Protocol In on the Run every scan task. So I am assuming this is the instruction to receive in is on. Is there another way to make sure the instruction to receive in is on?

      Comment



      • #18
        Look at the timing charts at the bottom of the help file. Once you get a complete ( whether a success or a timeout) you must disable the instruction and re enable to reset the bits and put in progress again.

        Comment



        • #19
          Originally posted by FEContractor View Post
          I looked at the video, I don't understand the question about the instruction to receive in on at all times. I have the Custom Protocol In on the Run every scan task. So I am assuming this is the instruction to receive in is on. Is there another way to make sure the instruction to receive in is on?
          In ladder logic, all the contacts have to be true for the coil/box instruction at the end of the rung to function. If you dont have any contacts in the rung, then it will be on (or, true) all the time. Productivity works likle this, but Do-More automatically places "always on" contacts at the start of a rung if you left it blank. Same thing, just different ways PLCs do it.

          If your custom protocol in does not bring any other messages in other than the first one, it likely needs to be turned off between messages and then cycled back on. Try something like this:
          Click image for larger version

Name:	custom.png
Views:	62
Size:	15.0 KB
ID:	119566

          Comment



          • #20
            Thank you for the above example. Now I see that I have been setting/resetting my Boolean variables the wrong way.

            Comment



            • #21
              Another reason I avoid conditionally calling tasks or subroutines. There's always a hang up somewhere.

              Comment



              • #22
                Originally posted by FEContractor View Post
                Thank you for the above example. Now I see that I have been setting/resetting my Boolean variables the wrong way.
                Been a couple days, so Im guessing it is all working now?

                Comment



                • #23
                  Yes everything is working. Thanks for all the information provided.

                  Comment



                  • #24
                    I implemented the second suggestion. I have the data set up in the rung with the NOE. I made a task that calls ASCII Out and have it on the next rung behind a NO contact. I have this contact set to close when the flasher sets the bit high. All of this is being done on the Run Every Scan section but I still only see the first message sent out. Nothing after this one.
                    Buy latest sofa covers online in Pakistan with delivery in Lahore, Karachi, Islamabad, Peshawar, Multan, Quetta, Hyderabad, Faisalabad and many other cities.

                    Comment



                    • #25
                      Can you post your diagram? Maybe someone could see where the issue is.

                      Comment

                      Working...
                      X