2

我正在使用 codesys (ST) 来创建一个 storekeeper 程序。

我有一个持久变量,它是一个结构名称 ST_STORAGE,这里定义:

TYPE ST_STORAGE :
 STRUCT
  xInitialized :BOOL; // Indicate if the storage have been already initialized
  astStore :ARRAY[0..9 ,0..9] OF ST_Location; // Indicate location (composed of columns and rows) available in all storage
  uiNbColumns   :UINT; // Indicate number of columns that are really availablein this storage
  uiNbRows :UINT; // Indicate number of rows that are really available in this storage
 END_STRUCT
END_TYPE

ST_LOCATION 结构由以下部分组成:

TYPE ST_LOCATION :
 STRUCT
   xEmpty       :BOOL;      // Indicate if location is used or empty
   uiColumn     :UINT;      // Indicate location's column where tool is stored
   uiRow        :UINT;      // Indicate location's row where tool is stored
   stToolRef    :STRING;    // Indicate RFID reference of tool stored
 END_STRUCT
END_TYPE

我的功能块 FB_Storage 接受输入:

VAR_INPUT
 i_xInitialize  :BOOL;                  // Indicate initializing instruction (init MAX column and row of the store)
 i_xScan            :BOOL;                  // Indicate scanning instruction (scanning locations to find our tool's reference)
 i_xStore       :BOOL;                  // Indicate storing instruction (storing a tool reference in a specified location)
 i_xPickUp      :BOOL;                  // Indicate picking up instruction (pick up a tool in specified location and clean location after picking up)
 i_sToolRef     :STRING;                // Indicate Tool ref to store in a speciefied location
 i_stStorage        :POINTER TO ST_STORAGE; // Indicate the storage to scan,store,pick up in    
END_VAR

所以我可以通过指针 i_stStorage 在我的存储中写入/读取。但我无法通过以下方式在我指定的位置读取或写入:

i_stStorage^.astStore[x,y].xEmpty
4

0 回答 0