adccommunitymod (AutomationDirect) asked a question.

Click PLC sending and receiving RS232 data

Created Date: May 04,2015

Created By: ryanmc

**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****

I 've written a small ladder logic program which will tell a PC which of 3 buttons have been pressed The program also takes a command from a PC to change a light from red to green I can make these 2 things work independently but I cant get them to work together please help! logic is attached ryan


  • adccommunitymod (AutomationDirect)

    Created Date: May 05,2015

    Created by: ryanmc

    I 've been reading some threads around the forum

    I think this is because i'm receiving in each pass

    So the sends don't get processed

    Apologies I'm very new to PLCs but happy to learn

    TIA

  • adccommunitymod (AutomationDirect)

    Created Date: May 05,2015

    Created by: Tinker

    Have you read the CLICK user manual ? http://www.automationdirect.com/static/manuals/c0userm/c0userm.html

    it might be worthwhile, especially chapter 4, it gives a reasonably good description of interlocking send/receive instructions.

    It looks like you have the receive rung enabled virtually all the time, it does turn off for one scan once it has received a string, but then is immediately re-enabled.

    As far as I can tell, the CLICK can not walk and chew gum at the same time. While full duplex is possible with RS232 as there are separate transmit and receive lines, the CLICK apparently does not implement that. If receiving is (virtually) always enabled it will be difficult or impossible to send.

    I'm not sure if the send instruction could grab control of the port in the one scan the receive instruction is off after receiving a string (if it receives a string, since you have no timeout it could block forever in there is nothing to receive). Even if that is possible I think a more robust interlocking would be wise.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: May 05,2015

    Created by: ryanmc

    Thanks for coming back to me Tinker...

    I 've been reading everything I can find on these PLCs including the manual

    I came across the timer setup in the ASCII repeater example some time ago

    I tried to implement it in my code but... no joy

    I'm having some issues getting my head around the interlocking principle

    I changed the code to do this last night (See attached)

    It should only perform send code on first pass then alternate for each cycle

    it looks like thats whats happening in the programming software when I monitor the code but it still doesn't work

    I'm really scratching my head here

    Am I having issues because all the sends set the same success flag c4?

    Would you recommend using a timer if one of the sends is encountered?

    Or locking it down as I 've done in this code

    What about that SC100 port ready flag as described in chapter 4 of the manual... should I be using that

    TIA

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: May 05,2015

    Created by: kewakl

    Have you tried the AD click Send/Receive example program?

    http://support.automationdirect.com/examples/CLICK/EP-COM-012_CLICK.zip

    on this page

    http://support.automationdirect.com/examples.html#com

    Get the AD example working with your PC terminal.

    Then (making descriptively-named backups) edit it to do what you want.

    Save *named* backups often and test after download.

    A well-described backup can help you go back to a rev that may work better than the latest.

    An example of my backup naming scheme is

    MACH(yyyy-mm-dd) {$$$$$$$$$$$}(VER_SPECIFIC).ext

    where

    MACH is a short description of the machine/program

    (yyyy-mm-dd) in this format for better file sorting

    Alphabetic rev level. Usually Capital A for UPLOAD and lower case for further edits per day

    {$$$$$$$$$$$} a text description of the major theme of the edit. --For the first upload of the day, I use {UPLOAD}

    (VER_SPECIFIC) if a process is version specific or if a sw/fw update is known to cause issues, OR has not been evaluated fully, I put the SW version here.

    Expand Post
  • adccommunitymod (AutomationDirect)

    Created Date: May 05,2015

    Created by: andremholmes

    Have you try using a timer?

  • adccommunitymod (AutomationDirect)

    Created Date: May 04,2015

    Created by: ryanmc

    I 've written a small ladder logic program which will tell a PC which of 3 buttons have been pressed

    The program also takes a command from a PC to change a light from red to green

    I can make these 2 things work independently but I cant get them to work together

    please help!

    logic is attached

    ryan

    Expand Post