Reading the data by SyncReadVarsFromPlc() brings me the following (hex trace):
- for single array element 'Application.PLC_PRG._arr_string[1]' - (length 11) - a a a 00 00 00 00 00 00 00 00 hex
- for array 'Application.PLC_PRG._arr_string' - (length 110) - a a a 00 00 00 00 00 00 00 00 b b b 00 00 00 00 00 00 00 00 c c c 00 00 00 00 00 00 00 00 d d d 00 00 00 00 00 00 00 00 e e e 00 00 00 00 00 00 00 00 f f f 00 00 00 00 00 00 00 00 g g g 00 00 00 00 00 00 00 00 h h h 00 00 00 00 00 00 00 00 i i i 00 00 00 00 00 00 00 00 j j j 00 00 00 00 00 00 00 00 hex
The question is - how can I parse the data block (length 110 bytes) which I received for whole array variable arr_string? There is no info about length of each array element in PlcSymbolDesc for _arr_string.The length of each element can only be seen in PlcSymbolDesc for _arr_string[XXX] - 11 bytes. But symbol descriptions for the array and its elements are only linked by the symbol names - I think it's not the right way to get array element size by comparing the names of PlcSymbolDesc structures. The same with the symbol type name of the variable ('ARRAY [1..10] OF STRING') in the field PlcSymbolDesc.pszType. Is there any other _more_simple way to handle this?
Hello!
I'm using PLCHandler library.
Having simple IEC project with an array of strings
I got the list of variables by calling GetAllItems().
PlcSymbolDesc for this variable contains
Reading the data by SyncReadVarsFromPlc() brings me the following (hex trace):
- for single array element 'Application.PLC_PRG._arr_string[1]' - (length 11) - a a a 00 00 00 00 00 00 00 00 hex
- for array 'Application.PLC_PRG._arr_string' - (length 110) - a a a 00 00 00 00 00 00 00 00 b b b 00 00 00 00 00 00 00 00 c c c 00 00 00 00 00 00 00 00 d d d 00 00 00 00 00 00 00 00 e e e 00 00 00 00 00 00 00 00 f f f 00 00 00 00 00 00 00 00 g g g 00 00 00 00 00 00 00 00 h h h 00 00 00 00 00 00 00 00 i i i 00 00 00 00 00 00 00 00 j j j 00 00 00 00 00 00 00 00 hex
The question is - how can I parse the data block (length 110 bytes) which I received for whole array variable arr_string? There is no info about length of each array element in PlcSymbolDesc for _arr_string.The length of each element can only be seen in PlcSymbolDesc for _arr_string[XXX] - 11 bytes. But symbol descriptions for the array and its elements are only linked by the symbol names - I think it's not the right way to get array element size by comparing the names of PlcSymbolDesc structures. The same with the symbol type name of the variable ('ARRAY [1..10] OF STRING') in the field PlcSymbolDesc.pszType. Is there any other _more_simple way to handle this?
BR, Eugene
Related
Talk.ru: 1
Talk.ru: 2
Talk.ru: 3
Talk.ru: 5
Talk.ru: 7
Talk.ru: 8
you can always ask the LEN of any string.