Peter Nachtwey
Member
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.
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?
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?