AG_SEND or AG_RECV with SCL

RollingPin

Member
Join Date
Feb 2008
Location
Bangalore
Posts
36
I am using SCL for a bit of TCP programming on an S7-400. How do I link the DB to the AG_SEND or AG_RECV FC? In the case of FBD or ST, you use
P#DB1.DBX0.0 BYTE 4 at the RECV parameter.
I tried a similar syntax in SCL (see below)

AG_RECV(ID := 1, LADDR := W#16#1FFB, RECV := P#DB4.DX0.0 BYTE 10,
NDR => TempBool, ERROR => TempBool, STATUS => TempWord, LEN => TempInt);


The compiler throws an error "Illegal data type for constants". Anybody knows the correct syntax?
 
Use View AT and contruct the anypointer as follows:

Code:
VAR_TEMP
  iMotorIndex:INT;
  iData:INT;
  Area:ANY;
  
View AT Area:STRUCT
	ID:BYTE;
	TYP:BYTE;
	NUM:INT;
	DBN:INT;
	PTR:DWORD;
	END_STRUCT;
END_VAR
View.ID:=16#10;
View.TYP:=16#02;
View.NUM:=10;
View.DBN:=4;
View.PTR:=16#84000000;
AG_RECV(ID := 1
		,LADDR := mw902
		,RECV :=  Area
		,NDR :=  M0.0
		,ERROR :=  M0.1
		,STATUS :=  mw900
		,LEN :=  iData
		);
 
Hi L D[AR2,P#0.0],
From the looks of what you have written, the 'Area' variable is a pointer to a DB. Do the individual components of this variable have specific documented significance? Where do I find this information?
I can guess that NUM is the number of bytes and DBN is the DB number. Now what do the ID, TYP and PTR mean?
Thanks.
 
You mean like this ?

Code:
DATA_BLOCK DB111
STRUCT
RxBuffer:ARRAY[1..10] OF BYTE;
END_STRUCT
BEGIN
END_DATA_BLOCK
FUNCTION FC111: INT
VAR_INPUT
bInput1:BOOL; //Comment for input 1	
END_VAR
VAR_TEMP
iMotorIndex:INT;
iData:INT; 
END_VAR
 
AG_RECV(ID := 1
		,LADDR := mw902
		,RECV := Db111.RxBuffer
		,NDR := M0.0
		,ERROR := M0.1
		,STATUS := mw900
		,LEN := iData
		); 
 
FC111:=0;
END_FUNCTION
 

Similar Topics

I'm trying to understand how the various PLC's in our machine are communicating and I've gotten so far but come with a bit of a dead end... Basic...
Replies
15
Views
8,971
Hello! Slightly confused at the moment regarding the maximum number of bytes transferable via the AG_SEND (FC5, V4.2),AG_RECV (FC6 V4.7)...
Replies
8
Views
12,282
I'm looking for documentation for the functions PDAT_CY, PCD_SEND and PCD_RECV that are part of an existing Step-7 program. The best I can find so...
Replies
1
Views
2,395
Hi I just came back from a project where I had to help someone else with his PLC where he was using a CP342-5 to exchange data with a Profibus...
Replies
0
Views
1,502
Hi everybody, I could not find any useful information about this blocks for siemens s7-300.I would like to find out how can we use those...
Replies
18
Views
9,869
Back
Top Bottom