STEP7 question

GEOFRA

Member
Join Date
Jul 2002
Location
Nicosia
Posts
99
Hi everybody!
I am new to STEP 7 and I would appreciate some help.
I am trying to write a LADDER program and I want to use a comparator. If i insert a comparator and on one input I insert MW4 or MD4 for example and on the other input I want to insert a value either in HEX DW#16#0002 , W#16#0002 or in decimal B#02 I get I message that I have a syntax error.Can somebodey help on this?
Can somebody clarify to me when to use an FC instead of FB and why?
 
the compare function compare two Integer, double integer or real numbers


to overcome this u can do so

l w#16#005
T mw 2


and then u compare the the two words

i think there are beter ways to do this
 
Another option is to disable type check on the addresses. In LAD/STL/FBD editor choose Options -> Customize, go to the LAD/FBD tab and uncheck the 'Type Check of Addresses' option.

Use an FC if it is not necessary to store the internal variables, iow if you don't need stat type parameters. Why? Because the number of FBs available is limited.

Kind regards,
 
Step 7

Thanks for the answers but I still need some clarification.
How can I use a comparator(LADDER) in order to compare two HEX or binary or integer numbers if I want to use a WORD/DWORD in one input and directly enter the number in the other input?
Can I have an FB without a related DB? If yes how can I call it in my OB1?
If I create a FB and write a program in it that does use only global variables and not any local ,if I have timers and counters in it do I need a DB to hold there current values or it will behave as a subroutine as it is in S7-200 series with MicroWin.Bare in mind that I use these values of counters and timers only in the FB and not outside of this.
 
Disclaimer, the following applies to 300/400 CPUs!

... and I'm not sure to what extent the 200s are similar.


I'm afraid I don't understand what your problem with the comparator problem is, so I can't help you any further there.

As far as using an FB without a DB is concerned, yes you can do it if you don't need any stored local variables and you can call it using the UC or CC commands. However, by doing that, you are effectively using the FB as an FC anyway, so why not just use an FC to start with.

One case where you might still prefer to use an FB is if you're not sure whether or not you will need to use stored local variables or not. However, if you do decide at some point that you want to add stored local variables, then at that point you will need to create the Instance DB so hold them.
 
So except FB can has multiple instance of SFB's inside (because it use Stat datatype which FC doesn't support), the only difference for FB and FC is :

After execution ( back to calling blcok, and local memory replaced by others ) I can still access FB's internal value from it's instance DB and all the values in FC are lost.

Is that correct?

Another question about FB is:

If I have an instance DB which includes all the IEC timers (hundreds of), and the FB itself has all the block calling functions (such as call SFB4 as multiple instance call), the way to active the timers is to passby a bit which connected to "IN".

And I have some FCs which include some logic to active timer by
send out high level of the bit which connected to "IN".

I think there is no problem when the current FC (is actived I can access timers' ACC value. The question is, after execution of current FC and go to next FC, can I still access that specific timer's ACC value?

For example:

I have FB1 called "All timers", and instance DB for FB1 is DB1 called "All_Timers_DB", inside FB1 I have timers from TON_1 to TON_100.

Timer Called this way:

...
CALL #TON_1
IN:=DB100.DBX1.1
PT:=T#2H
Q :=DB100.DBX1.2
ET:=DB100.DBD14
...

And I also have FC1 to FC10, each of them has 10 timers.

Timer called like this:

...
A DB101.DBX0.1
= DB100.DBX1.1
...

Does it work?

when the program execute to FC1, the timer should be actived by passing the bit status. But once the program exectuing FC2, is that timer still alive? so it's still updating the "DB100.DBD14"?

Thanks.
 

Similar Topics

Hi, I'm new to Simatic Step 7 and I was looking for some help. i'm trying to initialize some bits in OB100, So that when every someone manually...
Replies
3
Views
1,289
O m0.0 O m0.1 A m0.2 = m0.3 Is the m0.2 "and'd" only with the m0.1 or is it "and'd" with m0.1 and m0.2 (which are or'd)? -{}-----|--()...
Replies
3
Views
1,703
Hi all, just have a theory question here. Using step7 5.5. I upload the hardware configuration from a dp or pn network that i do not have the...
Replies
3
Views
3,157
Can you help me with "generating" pointers? I have INT variable and I want to create pointer based on variable's value. For example var=30 =>...
Replies
2
Views
1,692
Have a little question how to do this: I want to do a ANY pointer wich gets a DBnr (INT) and number of bytes to send and number of bytes to send...
Replies
6
Views
2,058
Back
Top Bottom