Hello
I would like to create an array in an ST language subroutine, which I am not familiar with.
A priori you have to use the ARRAY function.
This would be a 2 column table of 24 rows.
The 1st column would record times, the second an INT or WORD value.
The collection would be triggered from a top (BOOL) from a subroutine.
Thank you for your help...!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
An array only consists of data of the same type.
To mix data types you need to create an array of struture. In this structure you can mix data types.
For example :
Define a structure in the tab Data type:
MyStruct
TYPE MyStruct :
STRUCT
Record_Time:TIME;
Trigger:BOOL;
END_STRUCT
END_TYPE
Define an array, for example in Glabal data :
VAR_GLOBAL
MyTab:ARRAY[1..24] OF MyStruct;
END_VAR
Nota : You can define your array from 0 to 23 or from 1 to 24 (or from what number you want !)
And you can use it, for example in the PLC_PRG :
PLC_PRg :
MyTab[1].Record_Time:=T#10s;
MyTab[1].Trigger:=TRUE;
Hello
I would like to create an array in an ST language subroutine, which I am not familiar with.
A priori you have to use the ARRAY function.
This would be a 2 column table of 24 rows.
The 1st column would record times, the second an INT or WORD value.
The collection would be triggered from a top (BOOL) from a subroutine.
Thank you for your help...!
Hello,
An array only consists of data of the same type.
To mix data types you need to create an array of struture. In this structure you can mix data types.
For example :
Define a structure in the tab Data type:
MyStruct
TYPE MyStruct :
STRUCT
Record_Time:TIME;
Trigger:BOOL;
END_STRUCT
END_TYPE
Define an array, for example in Glabal data :
VAR_GLOBAL
MyTab:ARRAY[1..24] OF MyStruct;
END_VAR
Nota : You can define your array from 0 to 23 or from 1 to 24 (or from what number you want !)
And you can use it, for example in the PLC_PRG :
PLC_PRg :
MyTab[1].Record_Time:=T#10s;
MyTab[1].Trigger:=TRUE;
Hope to have been useful to you.
BR
Related
Talk.ru: 1