Author Topic: Custom Function as ladder contact?  (Read 14156 times)

PESPLC

  • Newbie
  • Posts: 8
    • View Profile
Custom Function as ladder contact?
« on: January 29, 2004, 11:19:18 AM »
I can add a ladder contact and assign it to a custom function....
but I cannot find any TBASIC reference that explains how to change the logic state of the contact.

Is the N.O. contact shut while the function is executing?

I think my VB6 experience is causing a conceptual problem.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: Custom Function as ladder contact?
« Reply #1 on: January 29, 2004, 08:45:10 PM »
The state of the contact on the ladder program determines if the custom function will be executed.

Within the custom function, it is possible to set the logic state of any I/O by using the SETIO, CLRIO, TOGGLEIO or the SETBIT or CLRBIT function. However, most of the time you probably want to leave the change of I/O state to ladder logic instead of within a CF. Ladder logic is must faster and more code efficient when handling single bit I/Os.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

PESPLC

  • Newbie
  • Posts: 8
    • View Profile
Re: Custom Function as ladder contact?
« Reply #2 on: January 30, 2004, 04:41:56 AM »
I may not be educated enough to understand your reply so I'll re-phrase my question.

If I:

Define a custom function (dcusfunct)

Insert a ladder circuit
insert a n.o. contact
associate the new contact with the cusf name
insert an output (eg out8) so that the output activates when the cusf contact closes.

How do I get the cusf contact to close so that out8 will activate?

I can send a PC5 file if needed.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: Custom Function as ladder contact?
« Reply #3 on: January 30, 2004, 08:27:25 AM »
Cusf is not a relay or output so it does not "close a contact" if that's what you mean. You can parallel a coil with a CusF if what you want to do is to turn ON a contact of that coil and execute the CusF at the same time from the contact closure.

Please open up some programs from the "samples" folder of your TRiLOGI software and study the way the programs are written and you will have  a better understanding of how the program works. You can also visit:

http://www.tri-plc.com/examples.htm

for some sample program codes.

                  
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Joel Moore

  • Full Member
  • Posts: 128
    • View Profile
Re: Custom Function as ladder contact?
« Reply #4 on: February 05, 2004, 11:32:49 AM »
Another way of saying it is that custom functions can only be associated with outputs (coils) which are on the right-hand side of the ladder.

For some reason the editor allows you to associate a custom function with an input (contact) anyway but that must simply be an editor bug or something.

Looking at it from a VB6 perspective think of the inputs on the left-hand side of the ladder as events (timer ticks, an input closes, the ladder is scanned for the first time, etc) and the custom function that is associated with the output coil on the right-hand side is the event code.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

PESPLC

  • Newbie
  • Posts: 8
    • View Profile
Re: Custom Function as ladder contact?
« Reply #5 on: February 10, 2004, 03:11:53 AM »
Thanks Joel,

I had come to the same conclusion re: the editor.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Custom Function as ladder contact?
« Reply #6 on: February 13, 2004, 09:59:59 AM »
I guess I finally understood the question from the exchanges. When you create an input contact and scroll through the table using the left and right arrows the Custom Function table does not appear so you normally won't make the mistake of using the label name of a Custom Function. However, the Custom Function table can still be selected from the drop down menu. I guess the editor should have forbidded this action. This is an oversight on the editor design and could be fixed in the coming update.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS