Jump to content

Relay Outputs on v120-22-R1


Recommended Posts

HI all

I'm programming a project on a 1st gen V120 and wanted to confirm something about the relay outputs. I was attempting to write a program that could trigger a given relay output from more than one rung in the same module, but it appears that isn't allowed. For example, if a coil for output 1 is present in rung 1 and rung 2, then the coil for O1 in rung 1 is simply ignored. I can see some logic in not allowing this, but I found it strange that it doesn't trigger any error or warning if that was the intention. Could anyone confirm this for me? 

Link to comment
Share on other sites

53 minutes ago, ZK0 said:

HI all

I'm programming a project on a 1st gen V120 and wanted to confirm something about the relay outputs. I was attempting to write a program that could trigger a given relay output from more than one rung in the same module, but it appears that isn't allowed. For example, if a coil for output 1 is present in rung 1 and rung 2, then the coil for O1 in rung 1 is simply ignored. I can see some logic in not allowing this, but I found it strange that it doesn't trigger any error or warning if that was the intention. Could anyone confirm this for me? 

As far as I remember on the other PLCs that I have used before that's how it works, the code will only respect one Coil.

also, why someone will do that on purpose?.

 

I guess you could technically do it on subroutines as long each sub has the logic conditions that doesn't allow both to be active at the same time.... but again, why?

Link to comment
Share on other sites

  • MVP 2023
1 hour ago, ZK0 said:

For example, if a coil for output 1 is present in rung 1 and rung 2, then the coil for O1 in rung 1 is simply ignored.

This is basic to ladder logic and you need to recognize this in order to be proficient in this programming language. Understand that the coil is both activated (if off and power passes to the coil) AND deactivated (if on and power doesn't pass to the coil) by the logic in a ladder rung. If one rung turns it on and another turns it off, it can't exist in both states simultaneously. If two different logic conditions are needed activate a coil, then simply place them both in the same rung.

By the way, you can run Project Optimizer from the Build menu in VisiLogic and it will tell you all instances of duplicate coils.

Link to comment
Share on other sites

I understand, thank you very much for your responses. The reasoning behind this was that I am trying to control a solenoid and two DC motors, with direction switching, using only the 6 relay outputs. Simplified to clarify, motor 1 may be controlled by outputs 0 and 1, then motor 2 may be controlled by outputs 1 and 2, so pressing one button would set Os 0 and 1 and another button would set Os 1 and 2. I have ended up just splitting the two functions into different sub routines, rather than controlling everything from one screen. 

Link to comment
Share on other sites

45 minutes ago, ZK0 said:

I understand, thank you very much for your responses. The reasoning behind this was that I am trying to control a solenoid and two DC motors, with direction switching, using only the 6 relay outputs. Simplified to clarify, motor 1 may be controlled by outputs 0 and 1, then motor 2 may be controlled by outputs 1 and 2, so pressing one button would set Os 0 and 1 and another button would set Os 1 and 2. I have ended up just splitting the two functions into different sub routines, rather than controlling everything from one screen. 

Thats the use of set reset, and any way the other option is to use flags or auxiliar contacts to use one single output.... at the end ladder logic is like an rlectrical diagram, you just can not have duplicate coils, but you could have many contacts  that can set the same coil based on different conditions.

 

I don't want to be that guy, but the way you are trying to solve this problem is not correct. for now it may work, but if you keep doing your logic like this... its going to be a mess and hard to troubleshoot.

 

Trust me, I've been there ...when I was still learning. good practices and well structured code will save you a lot of time in the future.

 

Link to comment
Share on other sites

  • MVP 2023

On top of what Fernando says, doing it the way you're suggesting can create issues with the potential to have conflicting instructions occurring during one scan, which can play havoc with physical devices.  If you are determined to continue along the path you've chosen, I would be placing a deliberate small time delay between each change of control, such that the "new" control does not do anything for a few scans at least, and likely longer would be better.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...