Hello, I'm new in PLC programming so I need a little help...
I have an array of char (ARRAY[0..2047] of CHAR) in DataBlock and I need to scan that array for specific character or character combination... And i need to get adress of the result.
Ex: Find the adress of the first char 'b' in the array (of random data). And find the adress of the char 'o' followed by char 'z'...
Something like that.
My try:
In OB1 i have:
CALL "Func"
UID:="Block1".array1
in FC1 i have (from some example):
(UID is type ANY)
TAR1 #_ar1
L P##UID
LAR1
L W [AR1,P#0.0]
T #_wPLC_Type
L W [AR1,P#2.0]
T #_iLen
L W [AR1,P#4.0]
T #_iDB
L D [AR1,P#6.0]
AD DW#16#FFFFFF
SRD 3
T #_dwArea
from this i get data type, length of the data, DB number, and start adress.. And then what?
Is there a simple way to loop the array with like: L DB1.array1[n] where n is variable (like in C++, C#, pascal, etc..?). And not using pointers (which I'm not yet familiar with)
I have an array of char (ARRAY[0..2047] of CHAR) in DataBlock and I need to scan that array for specific character or character combination... And i need to get adress of the result.
Ex: Find the adress of the first char 'b' in the array (of random data). And find the adress of the char 'o' followed by char 'z'...
Something like that.
My try:
In OB1 i have:
CALL "Func"
UID:="Block1".array1
in FC1 i have (from some example):
(UID is type ANY)
TAR1 #_ar1
L P##UID
LAR1
L W [AR1,P#0.0]
T #_wPLC_Type
L W [AR1,P#2.0]
T #_iLen
L W [AR1,P#4.0]
T #_iDB
L D [AR1,P#6.0]
AD DW#16#FFFFFF
SRD 3
T #_dwArea
from this i get data type, length of the data, DB number, and start adress.. And then what?
Is there a simple way to loop the array with like: L DB1.array1[n] where n is variable (like in C++, C#, pascal, etc..?). And not using pointers (which I'm not yet familiar with)
Last edited: