S7 data right format o syntax for ANY type parameter

cagliostro

Member
Join Date
Feb 2007
Location
vi
Posts
106
Hi to all,

I'd like to know if is possible and how to write the right data format in the input parameter SRCBLK of SFC20.

I know how use the ANY parameter if I want to write the direct address area in SRCBLK of the SFC20
eg: P#M240.0 BYTE 20

But I dont'know how to write the right syntax or code, if the SRCBLK data comes from IN data of FCxxxx define always as ANY data type.....

Probabilly this picture help you to understand well

thanks in advance

immaginewf.png
 
...but also note that if the ANY pointer points to the local data of the calling block, you cannot pass the ANY pointer on to SFC20

As you are only transferring 3 words, why bother with SFC20 ?

Why are you not using a named local data area ?
 
Last edited:
Excuse me,

I think you mean copy the Data_IN in TEMP data of FC5, and use the TEMP data in SRCBLK of SFC20.

I must define the TEMP data like ANY ?? And how copy the Data_IN in TEMP data.

Thanks a lot again
 
Last edited:
As you are only transferring 3 words, why bother with SFC20 ?

I think so, for pass 3 words there is no reason to use SFC20.
I'm develop a standard routine of miscellaneous flag eg:CPU 1st scan,bit always ON and OFF etc. etc. so I' d like to pass the P#L 6.0 WORD 3 of OB1 (CPU previous scan Time,Max scan time,Min scan time) as data Input define ANY parameter of my stadard routine FC5.
And in the Output parameter of FC5 get 3 different out where i link my MWxxx or DB.DBWxxx with the actual,min and max CPU scan time.

Pratically I'd like if is possible use only one data input like any parameter and write three distinct output.
If not possible I'll use the classic MOVE instruction three time for the three data about CPU scan time.
 
Last edited:
.. examples shown below:

(Edit: As you are planning on passing local data then you cannot pass on the ANY pointer to SFC20, use method 1)

Code:
FUNCTION FC 2 : VOID
TITLE =
VERSION : 0.1


VAR_INPUT
  Data_IN : ANY ;    
END_VAR
VAR_TEMP
  iDB : INT ;    
  wData : ARRAY  [1 .. 3 ] OF WORD ;    
  pSrc : ANY ;    
  SFC20_Code_Err : INT ;    
END_VAR
BEGIN
NETWORK
TITLE =method 1 - copy using address registers

      L     P##Data_IN; 
      LAR1  ; 
      L     W [AR1,P#4.0]; 
      T     #iDB; 
      L     D [AR1,P#6.0]; 
      LAR1  ; 
      LAR2  P##wData; 
      OPN   DB [#iDB]; 
      L     W [AR1,P#0.0]; 
      T     W [AR2,P#0.0]; 
      L     W [AR1,P#2.0]; 
      T     W [AR2,P#2.0]; 
      L     W [AR1,P#4.0]; 
      T     W [AR2,P#4.0]; 
NETWORK
TITLE =Method 2 - using SFC20

      L     P##Data_IN; 
      LAR1  ; 
      LAR2  P##pSrc; 
      L     W [AR1,P#0.0]; 
      T     W [AR2,P#0.0]; 
      L     D [AR1,P#2.0]; 
      T     D [AR2,P#2.0]; 
      L     D [AR1,P#6.0]; 
      T     D [AR2,P#6.0]; 
      CALL "BLKMOV" (
           SRCBLK                   := #pSrc,
           RET_VAL                  := #SFC20_Code_Err,
           DSTBLK                   := P#L 10.0 WORD 3);




END_FUNCTION
 
Last edited:
If you want to use this method, then a pointer will do the job..

Code:
FUNCTION FC 3 : VOID
TITLE =
VERSION : 0.1


VAR_INPUT
  pOBData : POINTER ;    
END_VAR
VAR_OUTPUT
  OB1LastScan : INT ;    
  OB1MaxScan : INT ;    
  OB1MinScan : INT ;    
END_VAR
VAR_TEMP
  iDB : INT ;    
END_VAR
BEGIN
NETWORK
TITLE =

      L     P##pOBData; 
      LAR1  ; 
      L     W [AR1,P#0.0]; 
      T     #iDB; 
      L     D [AR1,P#2.0]; 
      OPN   DB [#iDB]; 
      LAR1  ; 
      L     W [AR1,P#0.0]; 
      T     #OB1LastScan; 
      L     W [AR1,P#2.0]; 
      T     #OB1MaxScan; 
      L     W [AR1,P#4.0]; 
      T     #OB1MinScan; 

END_FUNCTION

ob1fc3.JPG
 

Similar Topics

Have a fairly simple project wherein id like to monitor half a dozen Rh/temp sensors for dewpoint along with a few temp only sensors. i studied...
Replies
4
Views
2,870
Hi! I am doing my exam project which involves installing two Siemens diagnostic repeaters in a production line with visualization in WinCC...
Replies
2
Views
1,588
Hi all, In S7 I developed an FCxx in SCL, and declared as data IN the format ARRAY of INT [1..50]. So I build an DBxx of ARRAY [1..50] of INT...
Replies
5
Views
2,077
Hello I have a s7-1200 and I would like to read the tags present in this controller with my controllogix controller. The two controllers don't use...
Replies
5
Views
103
Hi folks, I'm not as accustom with Siemens & WinCC, however I've been asked to increase the amount of data an existing application is logging...
Replies
2
Views
65
Back
Top Bottom