在持久变量

时间:2017-02-15 11:03:54

标签: codesys st

我正在使用codeys(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

0 个答案:

没有答案