S7 SCL Programming sfc51 calling

Join Date
Sep 2005
Location
Niel (Antwerpen)
Posts
32
Hi,
I'm very new at siemens programming and wanted to know how to
call sfc51 into scl programming.
I wanted to see which slaves are connected at my s7-313 dp2
plc.
Could a have an example or some reference where i can study it.
Programming is no problem, but the search after the system things
is a big problem over the net. Not match to find :(

Greetings
 
Referring to the Siemens SCL Manual (A5E00324650-01)




4.6.12.2 Inserting Block Calls​




S7-SCL supports you when programming block calls. You can call the following blocks:​




•​
System function blocks (SFB) and system functions (SFC) from the SIMATIC libraries,
Function blocks and functions created in S7-SCL,
Function blocks and functions created in other STEP 7 languages.



Follow the steps outlined below:​


1. Select the Insert > Block Call menu command.

2. Select the required SFC, SFB, FC, or FB in the dialog box and confirm your selection with "OK".


S7-SCL copies the called block automatically to the S7 program and enters the block call and the formal parameters of the block with the correct syntax into the source file.​

3. If you call a function block, add the information about the instance DB.​

4. Enter the actual parameters required by the block. To help you select an actual parameter, S7-SCL indicates the required data type as a comment.​

 
Last edited:
Thanks Garcia for the explination,
It must not be so hard every time. :)
Thats the problem if you didn't get a education into it.
It's a lot of help for me !!
To give the status of the presents of the profibus candidates at the line followed call must be given.
The result should be in data bits 60..
I get a error at the last var (pointer).
I'll think its not the right way to set a pointer?

example find in out of a STL source

34 MW150 := RDSYSST(REQ : = TRUE
35 ,SZL_ID : = W#16#692
36 ,INDEX : = W#16#1
37 // ,RETVAL := MW150
38 ,BUSY : = M152.0
39 ,SZL_HEADER : = #ssl_header
40 ,DR : = P#M60.0 BYTE 16
41 );

It gives errors
E: L 00040 C 00011: Non-existent identifier.
E: L 00040 S 00018: Illegel data type for constants.
E: L 00040 C 00019: Invalid expression.
E: L 00040 C 00024: Invalid expression.
E: L 00040 C 00024: Invalid expression.
E: L 00040 C 00026: Invalid expression.
E: L 00040 C 00031: Invalid expression.
E: L 00041 C 00011: Compilation aborted owing to syntax error.

Can anyone help me with this?

Thanks,
Danny
 
I'm programming in SCL

I have also made a try to get the info out of OB86 but it doesn't work?
Normaly when there are DP slaves missing it would call OB86
In the tempary array stands the info of the broken or rebuild connections
of the candidates of the bus.
By some reason it will not go into OB86?
Do I have to configer something to let in happen ?

Here the example in organisation block OB86

ORGANIZATION_BLOCK RACK_FLT
(**********************************************************************************
Loss of Rack Fault (OB86)
**********************************************************************************)
VAR_TEMP
INFO: ARRAY[0..19] OF BYTE; // Area for OB86
DP_ADDR : INT;
END_VAR
BEGIN

// Info[11] contains address of the DP Slave
// Info[0] is code OF the failure:
// - B#16#38: outgoing event (DP Slave retrns)
// - B#16#39: incoming event (DP Slave falls)
// HAAL INFO DP STATIONS
DP_ADDR := WORD_TO_INT(BYTE_TO_WORD(INFO[11]));
PROFIBUS.STATIONINFO := DP_ADDR;
IF INFO[0] = 16#39 THEN
PROFIBUS.STATION[DP_ADDR] := TRUE; // SLAVE AANWEZIG
ELSE
PROFIBUS.STATION[DP_ADDR] := FALSE; // SLAVE NIET AANWEZIG
END_IF;
END_ORGANIZATION_BLOCK

any ideas why it's not working?

Greetings,
Danny
 
Hi,
If you want to use STL you can call SFC51 as follows:

SET
= "PROFIBUS".READ

CALL "RDSYSST" //shows false when configured slave down
REQ :="PROFIBUS".READ //BOOL
SZL_ID :="PROFIBUS".ID // w#16#292
INDEX :="PROFIBUS".INDEX // w#16#1
RET_VAL :="PROFIBUS".RET_VAL_SFC51 //INT
BUSY :="PROFIBUS".BUSY //BOOL
SZL_HEADER:=#SLZ_HEADER //STRUCT
DR :=P#DB1.DBX10.0 BYTE 16 //DATA DESTINATION

A "PROFIBUS".SLAVE_NO[3]
A "PROFIBUS".SLAVE_NO[5]
A "PROFIBUS".SLAVE_NO[6]
A "PROFIBUS".SLAVE_NO[7]
= "PROFIBUS SLAVES OK"





I have nodes @ 3,5,6,7

If you need more detailed diagnosis use FC125 or FB125

Sorry cant help with the SCL!!
 
Last edited:
Here's my code (which compiles but I have not run in a plc) to call SFC51 in SCL:-

Code:
FUNCTION_BLOCK FB99
VAR_TEMP
  // Temporary Variables
iReturn:INT;
sfc51Data:ANY;
View AT sfc51Data:STRUCT
	ID:BYTE;
	TYP:BYTE;
	NUM:INT;
	DBN:INT;
	PTR:DWORD;
	END_STRUCT;

SSL_HEADER: STRUCT
	LENTHDR:	WORD;
	N_DR:		WORD;
  END_STRUCT ;  
END_VAR
	View.ID:=16#10; //valid pointer
	View.TYP:=16#02; //byte
	View.NUM:=16; //16 bytes
	View.DBN:=0; //no db
	View.PTR:=16#830001E0; //area pointer starting at MB60
 
iReturn:=RDSYSST(REQ := m0.0,
			SZL_ID := w#16#0, 
			INDEX :=  w#16#0,
			BUSY :=  m0.0,
			SZL_HEADER := SSL_HEADER,
			DR := sfc51Data
		);
   
END_FUNCTION_BLOCK
 
If you're new to Siemens then maybe you should consider using FB125 or FC125 instead. If all you want to do is see which slaves are present (and perhaps then disable the rest so as to avoid loads of errors), then the FC125 is all you need.

You can download both of these and their help-files from the Siemens support site. They both use SFC51 to get hold of the data, but the interface is much more user-friendly - a big plus if, as you say, you're relatively new to Siemens!
 
SFC 51 - Info great!

Guys,
Thanks for all the information on SFC51 programming. I know this is an old thread, but still want to thank all those who have posted the STL examples.
Cheers:)
 

Similar Topics

Hello all, I was trying to do some online programming on a AB control logix PLC v20. I added a new function block routine and added in an SCL...
Replies
3
Views
1,991
hello there my aim is to write a bigger program but i noticed that there was a difference if I calculate c1 first and then c2 ,and if i...
Replies
4
Views
2,057
Hello everbody out there. I have 2 topics actually I wanted to share and get your opinions about but since they are related I sum up in one...
Replies
14
Views
9,883
I start to use SCL on MP377 - Siemens Step 7 v5.5 (SCL v 5.3), and I've got some questions: 1) What is "Data Block Referencing UDT" about? What...
Replies
5
Views
4,920
Hi I read somewhere that Siemens are going to lauch SCL onto the 1200... any one know when this is likely? The limitations of Ladder & FBD are...
Replies
11
Views
5,623
Back
Top Bottom