Join us today!
[Solved] System status light with adjustable On and Off timers
Write a reusable PLC logic to control a system status light with adjustable On and Off time durations using any language.
Sample:
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
@twincontrols Here is my finished, corrected version recorded on a .webm file and some screenshots. Thank you for your help.
@ehixenbaugh You're welcome! Glad you got it working!!
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
I have this solution
@joris Well done!!! Maybe there's also a way to solve this using less variables 🤔 🙂
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
@twincontrols What are you thinking about? xIsOn, xIsEndOff? It's to have a clean code, to be readable for all.
@joris Yes, I totally understand. You can also use one of the timers output as the input of the other timer and can solve this using 2 rungs. Your solution is great though! Thanks for sharing!
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
I am new to TwinCAT and am having trouble understanding how to use a TON/TOF inside of a function block.
When I try to make a Function Block called StatusLight, I have the following variables:
//Public Variable with Only Read Access
b_OutputLED : BOOL;
//Public Variables with Read+Write Access
b_InputSignal : BOOL;
t_onTime : TIME;
t_offTime : TIME;
//Private Variables Hidden to the User
fb_timerTON : TON;
fb_timerTOF : TOF;
I want to put the logic for the timers inside the StatusLight function block, but anytime I do that and create an object in the MAIN program, the timers themselves do not operate. I have read on other forums on the internet that you can't do this. Can someone explain why this is to me.
(NOTE: Inside the FB for Status Light, the code for creating the on/off timing sequence is not complete. I wanted the focus of my question to be about why the TON/TOF function blocks can't work inside a new function block)
-Evan H.
@ehixenbaugh You can use function blocks inside a function block without any problem. Your first timer input is expecting b_InputSignal to be HIGH, but in the MAIN program, you haven't set that property yet. And instantiate your function block in MAIN.
FB_MyStatusLight();
In case you want to say thank you !)
We'd be very grateful if you could share this community with your colleagues and friends. You can also buy us a coffee to keep us fueled 😊 This is the best way to say thank you to this project and support your community.
twinControls - https://twincontrols.com/
@twincontrols Ok I did that and it worked like a charm. Sorry I had some replies that I deleted.
- 17 Forums
- 267 Topics
- 924 Posts
- 0 Online
- 737 Members