S7 Pulse Train ?

Jim.M

Member
Join Date
Dec 2008
Location
Sweden
Posts
77
Hi,

I want to start a device every 20 min for aproxm.. 20 sec.. then wait 20min until next start.. S7 timers are driving me mad.. is there a simple way to program this ??

//_ Jim
 
You can use a counter to accomplish this.
Use a 1 sec pules on the input to the counter.
Use an integer compare block to turn on the output for the device if the counter value is less than 20.

When the counter value is >= 1220 ((20minutes*60sec)+20 seconds) then reset the counter value.

Jemac
 
I do not think that there is a standard function for this.
It would not be difficult to make your own FC for this.
Once you have written it, you can use it over and over in the
future.

For the 1sec pulse you can use go to the Hardware Config and select the CPU properties. Go to the "Cycle/Clock Memory" tab and check the "Clock Memory" box and enter a memory byte number in the place for it.
Example "5"
Save and download the hardware config and then you can use M5.5 as the 1 second pulse.

ha det god
Jemac
 
I do not think that there is a standard function for this.
It depends on what you call a standard function. The simplest way to accomplish this is to use a cyclic interrupt OB (OB30..OB38). Strictly speaking, it's not a function, but it's pretty standard.

Kind regards,
 
Here´s one proposal that have the functionality.

Anyway, if you are to reuse the code many times it´s better to make a FC/FB and do it like earlier poster suggested.

Timer.jpg
 
It depends on what you call a standard function. The simplest way to accomplish this is to use a cyclic interrupt OB (OB30..OB38). Strictly speaking, it's not a function, but it's pretty standard.

Kind regards,


I thought of suggesting the cyclic interrupts, but personally, I like to reserve them for higher level functions (safety, PID, etc)

Plus there are a limited number of interrupts to use. I think 4 on the S7-300 and 8 on the S7-400. I do not know about the S7-200.

Jemac
 
Okey.. some good suggestions here.. I like to hear ppl that se this in diffrent angles.. Gives me a better picture how the PLC works..

The one suggestion with the FC sounds good, then i can re use this over and over again... And the one with timers is also a way to make it quick..

If i make an FC i suspect that i need the sulution with a memory bit and a counter built in to the FC..

One thing that crossed my mind here is... What if I use, for example counter C10 in my FC.. and say for example thtat i want to use this FC in another S7 program in future.. can there be a conflict with the Counters i C10 is already in use by this program ? Does S7 warn me about this ?


//Jim
 
okey.. But if I use the IEC timers and counter... what shall i put where the ??? of the block is, might sound stupid asking this.. but with the standard timers i only use ex.. T20.. T3 etc.. ?
 
If you want to make a FC for your ON/OFF timer, I would not use the counter function built in to the S7 software. What I would do is make a FC and store the accumulated time value (the count) in a Memory Word.
You can do this by defining the accumulated value in the IN/OUT section of the header. Then assign a MW to it when you call the FC. I tried it yesterday and it worked pretty good.

I used the following header assingnments:
IN:
TIME_ON INT
TIME_OFF INT

IN/OUT:
ACC_TIME INT

OUT:
TIMER_OUT BOOL

TEMP:
TOTAL_TIME INT

LAD1
TOTAL_TIME = TIME_ON + TIME_OFF

LAD2
IF ACC_TIME < TIME_ON THEN TIMER_OUT = TRUE

LAD3
IF ACC_TIME >= TOTAL_TIME THEN ACC_TIME = 0

LAD4


----------||--------------[P]----------ACC_TIME=ACC_TIME+1
1Sec Pulse ONE_SHOT








OB1

LAD1
______________
| FC1 |
-----------|EN | Q0.0
| TIMER_OUT|------------( )-----
20---|TIME_ON |
| |
1200---|TIME_OFF |
| |
MW 300---|ACC_TIME |
| |
--------------


Please excuse the pseudo-code and the poor ASCII art, but you should be able to understand what I was talking about.

Jemac
 
Last edited:
jemac25 - when you create an FC like this and want to post it, create the source code (in absolute addressing format) and post that - we can then copy/paste the source code into Step 7 and compile it to produce the block with no typos.
 

Similar Topics

I would like a sanity check on an application i am working on. I have a proximity switch counting pulses with a Mark/space ratio of 1:1 on a...
Replies
2
Views
1,877
Hello, I am using pulse train output to a stepper driver to control a stepper motor. It seems to work fine except when I use a Control Stop...
Replies
16
Views
3,325
Hello All I have a system using the ML 1400 plc. I have an encoder on HSC:1 input 4. I want to pass this signal out on a FET output to another...
Replies
5
Views
1,960
Dear Expert, I am doing troubleshooting positioning control in Servo amplifier Mitsubishi MR-J3-A. He get pulse train input from FX1N. PLC...
Replies
1
Views
1,669
Hi, i already make a program CP1E with pulse train ouput (PLS2) to control stepper vexta. Can i use work online simulator in cx-programmer to see...
Replies
1
Views
1,459
Back
Top Bottom