More Stupid S7 questions.

Join Date
Apr 2002
Location
No income tax, no capital gains tax. Freedom!
Posts
8,351
1. How does one indicate pass a parameter to a FC or FB in ladder without first declaring a variable? In the on-line help it says that TRUE and FALSE are valid boolean values. My Berger books don't say anything.

Code:
     CALL  "RMC75FB" , "RMC75DB"
       Command:=
       Param1 :=
       Param2 :=
       Param3 :=
       Param4 :=
       Param5 :=
       S7DB   :=
       s7Off  :=
       RMCDB  :=
       RMCOff :=
       Count  :=
       bRead  :=  TRUE         // Should take TRUE or FALSE
       DN     :=
       ER     :=
      NOP   0

I find that I must declare the variables TRUE and FALSE to be BOOL and then initialize them. It would seem to me that a 0 or 1 should work but it doesn't. I don't need to declare Zero to be a variable and initialize it to 0 before I can use 0 as a parameter to a function or FB.


2. Notice the call to RMC75FB. How can I make the instance DB a parameter? The problem is that there may be many motion controllers, each with its own FB. Hard coding FBs and DBs is not good as I don't know if the user appication is already using FB75 or DB75.

3. I think I can used shared DBs to and pass the DB to the function, but I hate to do this as all the addresses must be hardcoded. Is there a way around this? Using hard coded addresses is not an option.

This would be easy in C.

BTW, what I am trying to do is write a bunch of motion blocks similar to Control Logixs motion blocks. I am finding this difficult if not impossible to do. The motion controller communicates with the S7 over Profibus DP.

Are there any advanced S7 users out there?
 
Far from advanced, but maybe I can help

by using an FB, the parameters are optional. The PLC looks to the data block for a default value.

For a bool ,in ladder, you need to insert a contact and assign an address to it, assigning it 0 or 1 won't work.


As far as the data block deal, try


CALL "RMC75FB" , DB[block]


you will need to assign block a value before doing the call.



Let me know


-TDK
 
Hello !
You can declare the fields in the FB as STAT then you can put the values in the instanceDB...
All fields that are visible in the call are of the type: in,out or in/out fields
 
2. Notice the call to RMC75FB. How can I make the instance DB a parameter? The problem is that there may be many motion controllers, each with its own FB. Hard coding FBs and DBs is not good as I don't know if the user appication is already using FB75 or DB75.

Use FC-block with input-parameter DB-Number as Integer.

Be carefully with out-parameters, they have to handle somehow.
Otherwise they could be indefinite, they have contents when S7
stacking parameters in Call. That do not initializations for them and there could be anything 'last' in the stacked memory as in C.
 

Similar Topics

Hi everyone, recently i worked with a cmore panel and have the question that how can clear alarm list whit remote form,right now only can with...
Replies
0
Views
77
Hello, friends, I am trying to upgrade a system that uses an Onrom incremental encoder (E6B2-CWZ6C) connected to a Danfoss VFD (FC360), but now...
Replies
4
Views
245
Hello Friends I have took the sample program from AB webpage and modified, but I can only send 127 chars...
Replies
1
Views
156
Hello, I am new here and have been working with PLCs for a few years now. I have been tasked with setting up a Micrologix 1400….. to a Cmore 10...
Replies
10
Views
447
I am very familiar with Studio 5000 PLC programming. And I'm very familiar with C-More HMI programming. But this is my first time using a C-More...
Replies
2
Views
280
Back
Top Bottom