Function Calls in Step7

farmboy_jon

Member
Join Date
Oct 2002
Location
Ontario
Posts
8
im having some trouble in one of my labs, what im stuck on is this...

i need to turn on 3 outputs when the plc goes into run mode, using only two STL lines of Code.

I know i need to program this into OB100, im just not clear on how i can turn on 3 outputs regardless of anything else

after turning these outputs on i also need to turn them off when an input is sensed and turn on 3 more outputs using a function once again.

What im stuck on here i think is how to go about writing and calling functions
thanks in advance, jon
 
I will probably get this wrong but what the L, if you dont try you never will get it right.

I do ladder when I get the chance to do anything, if you were to start 3 outputs at once with same inputs then you "branch" the outputs
EX:

-------|input|---------------------(output1)---
|
|---(output2)---
|
|---(output3)---


Using STL (statement list) it will be something like:
LD input1 = output1
AND output2
AND output3

Note: I do not know STL and have not got the books here to look it up, hopefully though I am close enough for you to get the idea.

ALSO: OB are blocks with instructions, you create FB (function blocks that call the OB

See if this link will take you to the Software manual http://www4.ad.siemens.de/dnl/TQ1MDAyMQAA_1117858/Bhbv40_e.pdf

Others will offer more/better advice...be patient and post what you have done and where you are having problems.
 
Last edited:
Thanks for the help, but im not sure you understood what i was asking

I need to turn on these outputs regardless of any input conditions.

I understand what you were saying, branch at the end of the ladder and add more outputs.

It doesnt seem to want to let me turn on any outputs without an input of some type.


thanks
 
Oh thats easy then ...dont use the PLC to turn them on if you need them on when you start the machine, hardwire them to start when machine is initialized.

IF you want them on via the plc then use a start machine sequence to turn on an internal bit that is on as long as power is good or estop is ok (your choice).
 
hey, i think your right about latching the inputs, i never thought of that


so if i just did the following in OB100 it should work?

S Q output1
S Q output2
S Q output3


then id just need to make a function that resets each of these and call it to shut them off?


i think im gettin there, thanks guys
 
You're contradicting yourself Jon...

"I need to turn on these outputs regardless of any input conditions"

Yet earlier you wrote:

"after turning these outputs on i also need to turn them off when an input is sensed"

What if the input is sensed at powerup?

Instead of latching (which will work too), maybe just change Ron's (rsdoran's) example to use a "NOT" contact?

Code:
[size=3]
      INPUT
-------|/|-----------(output1)---
                 |
                 |---(output2)---
                 |
                 |---(output3)---
[/size]
beerchug

-Eric
 
sorry eric, what i meant is that the input has to go from off to on to turn these off, as for turning them on, it should occour despite any other conditions

not sure if your following me, but i think i've got a better understanding of what i have to do now

thanks for all your help, things are getting clearer and clearer
 
Then look at Eric's example a little close...using the XIC will make the rung true..ie ON when the input is OFF and when the input is ON the rung will go false..ie the outputs will turn off.

This can be confusing but in time you will get it.
 
You might want to investigate "edge detection"... See our lengthy discussion about that in THIS THREAD

beerchug

-Eric

Hey Ron and Jon, ever think of getting together and opening a surf shop?... :p

(Those who don't get that joke, click HERE)...
 
Believe it or not I know the people that started that, they are heavy into T shirt sales and travel to fairs etc, I was in the amusement business (actually grew up in it) so had the pleasure of meeting them many years ago.
 
Continued Off Topic...

....heavy into T shirt sales....

And I've bought my share! Great "work shirts" as they last a long time... Ron Jon's original Beach Haven, NJ store was always a yearly stop while vacationing on LBI. They recently built a huge new store on the same property.

Additional useless stuff... I knew the owners of "Things U Like" in Manahawkin, NJ who knew Ron back when he started out.

beerchug

-Eric
 
farmboy_jon,

the only way to activate more than 2 outputs with only 2 lines of STL code is bij transferring a bitpattern to these outputs. Since S7 works with doublewords at most, these outputs must be positioned within the same doubleword. This is basic info! The key phrase for your question is: check that bloody manual (or your courseware in case you're a student, which is probably the case).

Jean Pierre Vandecandelaere
Instructor PLC - SCADA
 
thanks Jean Pierre, i think i've got it now, i hope anyway

L 2#10110000
T QB 124

this should turn on outputs 124.7, 124.5, 124.4

correct?

i am a student, and yes i should know this stuff, but its not clear to me thats why i was asking

your help is appreciated
 

Similar Topics

So I have a program for an Omron CJ1M PLC that I have to reverse engineer for a customer. This PLC is meant to control a water pump station...
Replies
2
Views
1,839
Is this possible? I'll use this scenario as an example. I have a function block that represents the behavior of an I/O card, say a 2 channel...
Replies
8
Views
2,209
I know there is a way to do this...but I'm sufferring from brain-lock at the moment, and can't remember how :) I need to be able to pass a word...
Replies
8
Views
4,898
I am new to programming the Siemens Step 7 Micro/Win software. But I found a useful subroutine albeit Function Call on the internet to provide...
Replies
5
Views
5,837
Hi, I have attached herewith one image which our programmer has been used in S7 1500 PLC. Now we need to use the same instructions in S7 1200 PLC...
Replies
4
Views
118
Back
Top Bottom