Having an output lamp blinking at preset frequency

Paradigm1999

Member
Join Date
Sep 2011
Location
Asia
Posts
10
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 with TIA portal. Very new to this PLC and software.

Can I know what is the best way to flash the output indicating lamp at certain frequency. Lamp connected to DO stright.

I am using SFC currently with my program. Had program everything except the flashing. Need programming ideas. Thanks a lot
 
A "Hertz" is one complete cycle, ON then OFF.

One simple method is to use two timers, Timer 1 for ON time, Timer 2 for OFF time. Divide your preset HZ rates by 2, and set the timers value to desired HZ/2. Use Timer 1 to turn on light, then to start Timer 2, and use timer 2 to reset Timer 1.

Many PLCs have a Pulse Train Output or a Pulse-Width Modulated output. You could also use one of those methods.
 
Last edited:
Referring hertz you would have to calculate (1 / hz)/2 for each timer. Time is the inverse of frequency. 5 hertz would be 1/10th of a second per timer.
 
I believe that you can setup a memory byte to indicate 'flashes' or internal clock pulses.
This is done under object properties in hardware configuration in Simatic manager.
Im sure searching the help section in TIA would point you in the right direction.
 
A 1 hertz flash? The lamp would really struggle to turn on and off in that time! Would not last very long either.
 
I like using just one Timer to define the period of oscillation and then use a comparator to define the duty cycle.

Have a variable for the HZ and a variable for the DutyCycle.

Store the reciprocal of the HZ into the timer preset.
Multiply that by the DutyCyle and use that in your comparator to compare against the timers accumulated value.
Are you using S5 or IEC timers?
 
Hi, I am using PLC to program. No physical timers. I am programming a SFC. The flashing is just one part of the program. After flashing, the SFC should continue to next step. There is a step to off the lamp. So I am thinking is it possible to have a variable for time or hertz and another variable as the bit lamp to be flashing. Do I need to use a STL FB to do the job instead of ladder so that I can implement it inside the SFC
 
Hi, I am using PLC to program. No physical timers.
This being a PLC programming site, not many would think that we were talking about using physical timers. PLCs do have internal programmable timers.

Hertz is simply the cycles per second. 1 Hertz = 1 cycle/second. 5 Hertz = 5 cycles per second. 10 Hertz = 10 cycles/second. A cycle is one complete change or revolution. For an on-off device to complete one cycles means that it goes from off to on, then off again (switches 2 times per cycle).

An on-off light flashing at 1 Hertz would be ON 0.5 seconds, then OFF 0.5 seconds (entirely feasible with a PLC internal timer). 10 Hertz would mean the light switches on or off 2 x 10 or 20 times per second or every 1/20 or 0.05 seconds, still easily done with a PLC timer. However 0.05 seconds might be stretching the ability of the light to switch fast enough (and the human eye to see the difference). It might not appear to blink, but simply be less bright.

For using Siemens S7 clock bits without PLC timers, see this old post from user DChartier:
One way to pulse a bit in Step 7 is to use what Siemens calls a clock bit.
Open Hardware Config, double-click the CPU to open the CPU properties window;
open the cycle/clock memory tab, and click on the Clock memory checkbox. Then write in a byte number (10, for example) in the clock byte dialog box. This sets up MB10 as a clock byte, where each bit pulses at a different frequency (specific frequencies are described in the help for the tab).
Now in your ladder simply add one of those bits (M10.3 for example) in series with any output you want to control: a simple example to flash an output (change the clock bit for different frequencies)
 
M10.3 Q0.0
--------| |-----------------------------( )

You can modify this easily to check your inputs (this example will block the
flashing of the output depending on the state of the input):

M10.3 I4.0 Q0.0
---------| |------| |-----------------( )

Hope this helps,
Daniel Chartier

http://www.plctalk.net/qanda/showthread.phpt=4873&highlight=Siemens+clock+bits
 
Last edited:
what damian asked was what type of PLC timers you use. i'm guessing it's IEC since you using SFC. i think TON timer is sfc4. what you can do is to set one TON timer to a total time and do following:

] [-------(TON T1, total time)
start

temp:=int(T1 / preset_time) mod 2

temp
|==|-----]/[-----] [----(Lamp)
0 T1 start

] [--------(next step)
T1



exp: total time is how long that lamp should flashing, preset_time is time 1/flashing frequency - so until T1 expires lamp should flash with flashing frequency

or you can use a separate timer for flashing and separate for next step
 
Last edited:
I like using just one Timer to define the period of oscillation and then use a comparator to define the duty cycle.

Have a variable for the HZ and a variable for the DutyCycle.

Store the reciprocal of the HZ into the timer preset.
Multiply that by the DutyCyle and use that in your comparator to compare against the timers accumulated value.
Are you using S5 or IEC timers?

i agree with this method
 
For a lamp indicator, I like to just examine a binary member of the free running clock that is closest to what I want. In A/B plcs I make two symbols blink_fast blink_slow assigned to the s:4 bit that I like. I recently found that the ML1500 free running clock bits are many times faster than in a SLC, no problem, just shift them left a couple spots with an online edit...before the light bulb strobe hypnotizes you...If 0.512 seconds is close enough, or 1.024 seconds between alternations suits the indicator lamp...nothin's simpler.





FreeClock.Bit4
BLINK_FAST
------] [--------



 
Last edited:
For a lamp indicator, I like to just examine a binary member of the free running clock that is closest to what I want. In A/B plcs I make two symbols blink_fast blink_slow assigned to the s:4 bit that I like. I recently found that the ML1500 free running clock bits are many times faster than in a SLC, no problem, just shift them left a couple spots with an online edit...before the light bulb strobe hypnotizes you...If 0.512 seconds is close enough, or 1.024 seconds between alternations suits the indicator lamp...nothin's simpler.





FreeClock.Bit4
BLINK_FAST
------] [--------




proof that this forum really does need a like button haha
 
Hi All,

Thanks for your help. I am using what Lancie refer me to which is Daniel post and it works for me quite good. Thanks a lot
 
Hi,

If you work with Step7 than your can turn on the Clock Memory in your CPU Properties.
Go to HW configurations. Right click on the cpu and choose Object Properties.
Click the tab Cycle/Clock memory. Check the box clock memory and choose a memory byte u want to use like "M100"

If the PLC is running than M100.0 becomes high with a frequentie of 10Hz and M100.7 with 0,5Hz. Ofcours the bits between it have a different frequentie

And you can use the help function to find out more about this
 

Similar Topics

Hi all, To make a long and annoying story short, a client has two flowmeters in their water plant and the flowmeter that controls the CL2 dosage...
Replies
6
Views
2,327
Hey guys, Thanks for everyone's help with my last question regarding .ACC on timers. What I'm playing with today is getting a light (output) to...
Replies
7
Views
2,120
I copied a panel in factory talk HMI for an identical system. The label names are still the same as the original panel but I am trying to change...
Replies
1
Views
126
Hi All, Firstly… Merry Christmas to all of you! Secondly, as some of you may have noticed I made some modifications to our backend to address...
Replies
29
Views
7,059
Hi Everyone, I am supporting a system which runs on a SLC 500 (1747-L532). A fault has developed whereby the output state of some digital outputs...
Replies
10
Views
986
Back
Top Bottom