Blinking Lamp / Flashing Light - Structured Text

Join Date
Feb 2016
Location
england
Posts
3
Hey,

New to the forum so apologise if I break any rules.
I am trying to write a program insturctured text that will allow me to flash a warning lamp on and off indefinitely until it is manually reset, the lamp is triggered by an alarm signal.

I have tried with what I can so far ut keep getting stuck and cant seem to loop the program back on itself, I can get the lamp to switch on then switch off but not to come back on!

I have seen a few examples on this site of how to do it in ladder logic but I would like to implement it using ST. My attempt so far is below, please any criticsm or help is welcomed! Thank you

PROGRAM _CYCLIC Warning_Lamp;
TON_Warning(IN := Alarm_Active_Flag_1 , PT := T#2s );
IF(TON_Warning.Q = TRUE)THEN
Warning_Lamp := TRUE;
END_IF
TON_Warning_2(IN := TON_Warning.Q , PT := T#2s );
IF(TON_Warning_2.Q = TRUE)THEN
Warning_Lamp := FALSE;
END_IF END_PROGRAM
 
Last edited:
Hey,

New to the forum so apologise if I break any rules.
I am trying to write a program insturctured text that will allow me to flash a warning lamp on and off indefinitely until it is manually reset, the lamp is triggered by an alarm signal.

I have tried with what I can so far ut keep getting stuck and cant seem to loop the program back on itself, I can get the lamp to switch on then switch off but not to come back on!

I have seen a few examples on this site of how to do it in ladder logic but I would like to implement it using ST. My attempt so far is below, please any criticsm or help is welcomed! Thank you

PROGRAM _CYCLIC Warning_Lamp;
TON_Warning(IN := Alarm_Active_Flag_1 , PT := T#2s );
IF(TON_Warning.Q = TRUE)THEN
Warning_Lamp := TRUE;
END_IF
TON_Warning_2(IN := TON_Warning.Q , PT := T#2s );
IF(TON_Warning_2.Q = TRUE)THEN
Warning_Lamp := FALSE;
END_IF END_PROGRAM

Homework ? A similar question has been asked......

http://www.plctalk.net/qanda/showthread.php?t=101052
 
No, this isn't homework! it is a small project at work. Although that question is similar, it is different and not what I want. Thanks anyway though
 
No, this isn't homework! it is a small project at work. Although that question is similar, it is different and not what I want. Thanks anyway though

Its not that different, he wants it to flash 50 times a minute until reset, you want it to flash indefinitely until its reset....

The core code is pretty much exactly the same, have you tested the code in the PLC ?

Its generally useful to tell people what PLC you are using, you could use an internal clock for the pulse, most have a few with different timebases available.
 
I don't know structured text programming but all flashers work like this. The first timer times the on period. When the time on period is done it is held on and it turns off the output. it also turns on a second timer to time the off period. When the second timer is finished the second timer resets the first timer and then the first timer turns off. By doing that it resets the second timer. The cycle then repeats.
 
Think about how a TON works, and the first input signal. When it detects the input turning on, it starts counting. It needs that transition from OFF to ON to trigger the timer starting. The way your logic is right now, your TON_Warning_1 starts timing, finishes timing, and then never resets, because the Alarm_Active flag never changes.

What could you do to make the 1st timer reset after the 2nd timer ends?
 
Flasher Timer Setup, Free Running,
Replace "Buzzer" with Lamp

-------------------------------------
VAR
Flasher_1 :ton;
Flasher_2 :ton;
END_VAR
-------------------------------------

//------------------------------------------------------------------

Flasher_1(IN:=NOT Flasher_2.q, pt:=T#2s);
Flasher_1_Pulse := Flasher_1.q;

Flasher_2(IN:=Flasher_1.q, pt := T#2s);


IF Flasher_1_pulse
AND Alarm_Active_Bit
AND NOT(Mute_Bit)
THEN
Buzzer := TRUE;
ELSE
Buzzer := FALSE;
END_IF;
 
Last edited:

Similar Topics

Hi all Expert, I need to flash a lamp indicator at a preset frequency. It could be 1Hz, 5Hz or 10Hz I am using Siemens PLC S7-300...
Replies
13
Views
5,635
I have one GE Fanuc IC200PNS002-AC Versamax Network Interface Module and the fault red light is blinking and i have checked in manual it is...
Replies
9
Views
207
I have a Micro820, yes I know they are hated. I have a brand new Micro820 that I programmed with a Micro SD Card. Once I got it programmed, I...
Replies
5
Views
881
Hi, Have very basic knowledge of PLC's. Wondering if someone can point me in the right direction. Our assembly equipment is being run off of...
Replies
7
Views
1,158
Hi, I'm new to working with PLCs and I'm experiencing issues with my WAGO 750-8212 device. When I attempt to turn it on, the SYS LED (orange)...
Replies
1
Views
881
Back
Top Bottom