You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old September 16th, 2003, 04:15 PM   #1
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: Vancouver, WA, US
Posts: 6,718
More Stupid S7 questions.

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?
  Reply With Quote
Old September 16th, 2003, 06:45 PM   #2
The Dark Knight
Member
United States

The Dark Knight is offline
 
The Dark Knight's Avatar
 
Join Date: Jul 2002
Posts: 124
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
  Reply With Quote
Old September 16th, 2003, 08:15 PM   #3
Peter Nachtwey
Member
United States

Peter Nachtwey is offline
 
Peter Nachtwey's Avatar
 
Join Date: Apr 2002
Location: Vancouver, WA, US
Posts: 6,718
Thumbs down It doesn't work

Quote:
Originally posted by The Dark Knight

As far as the data block deal, try

CALL "RMC75FB" , DB[block]

Another question. Is there a way to format the real numbers. Real numbers in scientific notation does not make data easy to read.
  Reply With Quote
Old September 17th, 2003, 06:49 AM   #4
nif
Member
Finland

nif is offline
 
nif's Avatar
 
Join Date: Nov 2002
Location: Vantaa, Tikkurila
Posts: 196
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
__________________
B.R
Niklas
  Reply With Quote
Old September 17th, 2003, 07:06 AM   #5
seppoalanen
Member
Finland

seppoalanen is offline
 
seppoalanen's Avatar
 
Join Date: Jan 2003
Location: Finland
Posts: 1,132
Quote:
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.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Questions abt Siemens S7 200 Preeya LIVE PLC Questions And Answers 3 April 9th, 2007 07:39 AM
Stupid Siemens S7-300 Questions eaw LIVE PLC Questions And Answers 19 February 11th, 2005 01:27 AM
Building an S7 Array Move Questions DesertDog LIVE PLC Questions And Answers 19 June 17th, 2004 09:51 AM
Siemens S7 Timer Questions GTX LIVE PLC Questions And Answers 6 April 30th, 2004 09:55 AM
Backup S7 questions DeHulk LIVE PLC Questions And Answers 6 October 16th, 2003 10:59 AM


All times are GMT -5. The time now is 08:31 PM.


.