Some blocks compile without all variables

dahnuguy

Member
Join Date
Mar 2007
Location
SC
Posts
720
I noticed that when I use certain blocks in Step7, that you must supply information at each input or output of the block or it will not compile and has the 3 red ???.

However I also notice that some blocks do NOT require that all the inputs and outputs be defined.

Like the S_OFFDT for example.

I would like to include this feature in my blocks and functions that I write.

In this way I could have an optional item that could be left blank if not needed this time.

In this way I could combine 2 similar functions or provide several options of output for the same function.

Another good example is the PID block.

I suspect it may be because these are FBs with a DB assigned and the position is defined with a default value if none is provided.

Is this what happens when you name a Timer? Does naming "timer" to "T100" reserve a small bit of memory in which defaults are placed?

To compress:

Can you write a function such that if a variable input is left undefined, a default value is inserted.

or no value is required to save the block?
 
FB/FC difference (basic version)

FB

All input parameters are copied to the instance DB, the FB then accesses the parameters from the instance DB

All output parameters are copied from the instance DB after the FB completes

Parameters are optional. (The instance DB values stays the same)

Static data stored in instance DB so values can be stored here between scans (edge detection, accumulated values etc.)

Temp data area allocated from a stack and cannot be used as a permanent store. Must be initialised by code before being used.

FC

All parameters are passed by pointer. All parameters must be assigned.

No static data area

Temp data area as FB





This does not explain why the timer will compile without a parameter assigned.

As I understand it , the timer is not a FB. It would seem to be a standard FC.

It is a small thing but it will help me understand the Step7 structure better.
 
The timers and counters are "built in instructions" in Step 7 and are not FB/FC's. The ladder editor "knows" about these built in functions and allows certain parameters to be left blank.

(The IEC versions of timers/counters are built into the processor as system function blocks and are called in the same way as an FB)
 
"The IEC versions of timers/counters are built into the processor as system function blocks and are called in the same way as an FB"

I noticed that while using the IEC timer which called for a DB. This is what was throwing me on this issue.

I recall reading somewhere that S7 included the IEC but also used other versions of the same basic function for backward compatability.

So the timer having empty paramters is just built into the system and not available to the user.

Fair enough.

I am just beginning to look at conserving memory locations after exploring the functions and getting the data types somewhat under control.

During the learning phase I have been eating up memory just to make it simple.

S7 is difficult to pick up , but rewarding. Not wasted effort to learn.

Now I will feel constrained if I have to go back to brand Y.

Thanks again.
 

Similar Topics

I'm trying to include MOVs and fuses for solenoid PLC outputs in a panel with limited space. Does anyone know of terminal blocks that have built...
Replies
7
Views
235
Good morning crew! Ok my logic works but I am missing something. When the start button is pushed it should like the red light for 4sec then shut...
Replies
13
Views
419
I'm a bit confused about how symbols and UDTs work... As far as I know, in offline mode FB gets symbols from the UDT declared in the "state"...
Replies
4
Views
419
Hi, I am picking up a project started by a predecessor who is now out of contact. It is a Siemens S7-1515F PLC system - but the query is how you...
Replies
2
Views
734
Hi, is there any way to export all contents of Block folder (OBs, FBs, DBs, etc) to a text file? I know it is possible to export symbol table, but...
Replies
5
Views
1,235
Back
Top Bottom