ANY POINTER in SCL

mynameisrex

Member
Join Date
Oct 2005
Location
Lecco
Posts
2
I need to use SFC20 in SCL function block.
In KOP or AWL editor, the syntax for source or destination parameter is the normal ANY :

P#DB1.DBX 0.0 BYTE 200

...but in SCL ????
How can I address this block ???

Thanks to everybody.
 
Hi Rex

SCL does not encourage the use of absolute addressing. Your mind-set should be bent much more towards symbolic handling of data. There is no equivalent in SCL to the P# ... notation. For many of the the tasks which would require a pointer in KOP or AWL (LAD or STL) you can use simple indexed addressing in SCL.

So, for example, to read/write a value in a list in a DB, give the DB a name, create an array with a name, and create an index with a name. Then you can write expressions like -

TestValue := "MyData".List[Index]

MyData is the symbolic name of the data block, List is the symbolic name of the array (which should be the same data type as TestValue), and Index is an integer index whose value you change to select the array number.

Obviously there may be occasions when you do require control of not just indexed addressing, but full indirect addressing including memory area, address, size etc. Here there is no alternative to using a POINTER or ANY declaration and populating the component parts of it with the required values. The Siemens web-site (http://support.automation.siemens.com/) has an article, document ID 10625180, which explains how to create a function for manipulating the elements of an ANY pointer.

Regards

Ken
 
Here's a code snippet that I have used:

VAR_TEMP
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:=384;
View.DBN:=90;
View.PTR:=16#84000000;
iSFCError:=SFC20(SRCBLK:=Area,
DSTBLK:=StaticVariableInFB);
 
Last edited:

Similar Topics

Hallo, I've got a question I want to know or calculate the real address pointer of a merker byte. This example points to MB60, I don't know how...
Replies
4
Views
3,265
Hi, Is there a way to get a pointer from a datablock. For example I want the pointer address of DB2.DW0 in SCL Thanks, Danny
Replies
3
Views
2,421
I need to send a pointer to an array to a function. The SCL manual gives that example: FUNCTION FC100 : VOID VAR_IN_OUT N_out : INT...
Replies
0
Views
4,913
I have a word in some DB which I want to load to AR1 and use as a pointer. In order to do this I need to write L DBxy.DBW xy SLD 3 LAR1 I...
Replies
3
Views
526
I am trying to access the value of a pointer via OPC UA in Codesys. I can share it directly and in a struct but I cant access the value of it when...
Replies
5
Views
1,598
Back
Top Bottom