Step 7 Function block

Ranjith

Member
Join Date
May 2007
Location
Melbourne
Posts
316
I want to access any bit of an array of bytes created in the function block. For example Is DIX8.0 the first bit of the 8th byte in the declaration table?

FB.JPG
 
DIX 8.0 is bit number 0 of byte 8. If you want to get the first "To_Step7" address then use DIB0.0 (byte). You may use DIB,DIX etc, but when you change the FB, e.g. add an input, the data block will be regenerated and the addresses may be changed.
Please use: "Fault reset" as text in your logics instead of DIX144.3.
 
In cases like this, I create a temp structure and copy the byte from the array to the structure. I can then refer the individual structure elements by name and then the code will not need changing if the data areas are moved around by adding/deleting variables.

Code:
FUNCTION_BLOCK FB 1
TITLE =
VERSION : 0.1
 
VAR_INPUT
To_Step7 : ARRAY [1 .. 72 ] OF BYTE ; 
END_VAR
VAR_OUTPUT
Connected : BOOL ; 
Powered : BOOL ; 
Ref_Done : BOOL ; 
END_VAR
VAR_TEMP
ControlByte : STRUCT 
Connected : BOOL ; 
Powered : BOOL ; 
Ref_Done : BOOL ; 
END_STRUCT ; 
END_VAR
BEGIN
NETWORK
TITLE =
	 L	 #To_Step7[1]; 
	 LAR1 P##ControlByte; 
	 T	 B [AR1,P#0.0]; 
NETWORK
TITLE =
 
	 A	 #ControlByte.Connected; 
	 =	 #Connected; 
NETWORK
TITLE =
	 A	 #ControlByte.Powered; 
	 =	 #Powered; 
END_FUNCTION_BLOCK
 

Similar Topics

Dear Gentlemen Can any body tell me how to creat an new function block FB in Step 5. thanks,
Replies
5
Views
1,952
Hello, Is it possible to perform operation like pointer on function. Regardless of value inside pointer or what ever variable I want to call...
Replies
2
Views
1,497
Hi, is it possible to read the name of the steps in an S7 Graph sequencer? In the parameterinterface there is, for example the parameter #S_NO...
Replies
21
Views
7,187
Hi experts, I have seriously problems with my step 5 backup. Almost all PB blocks in my ST.S5D file has no logic that I can see. I try unlock...
Replies
7
Views
2,062
There`s a simulator for Simens Step 7 that I can use "Display Force Values" function? Hi, I`m trying to use the "Display Force Values" in...
Replies
7
Views
2,316
Back
Top Bottom