整个 PLC 的初学者,所以欢迎更正。
我正在尝试整理我的项目,当前情况是这样的:我从 modbus 收到 16 字节数组。这些充当按钮、灯、传送带,这些是您在 Factory IO 中所拥有的。
GAB_FactoryIO_Inputs AT %I* : ARRAY [0..15] OF BYTE;
GAB_FactoryIO_Outputs AT %Q* : ARRAY [0..15] OF BYTE;
Run Code Online (Sandbox Code Playgroud)
因此,我没有用它的位“IO.GAB_FactoryIO_Inputs[0].0”来指代“开始按钮”,而是做了一个笨拙的转换 POU 和 GVL 来遍历每一位并给它们一个新名称。所以它目前看起来像这样的 200 行:
IO.iSensor10_Capa := IO.GAB_FactoryIO_Inputs[7].3;
IO.iSensor9_Capa := IO.GAB_FactoryIO_Inputs[7].4;
IO.iPositioner_Limit := IO.GAB_FactoryIO_Inputs[7].5;
IO.iPositioner_Clamped := IO.GAB_FactoryIO_Inputs[7].6;
IO.iPick2_Detected := IO.GAB_FactoryIO_Inputs[7].7;
IO.iPick2_MovX := IO.GAB_FactoryIO_Inputs[8].0;
IO.iPick2_MovZ := IO.GAB_FactoryIO_Inputs[8].1;
IO.iPick2_Rot := IO.GAB_FactoryIO_Inputs[8].2;
IO.iPick2_GripRot := IO.GAB_FactoryIO_Inputs[8].3;
Run Code Online (Sandbox Code Playgroud)
和这个
iPositioner_Limit : BOOL;
iPositioner_Clamped : BOOL;
iPick2_Detected : BOOL;
iPick2_MovX : BOOL;
iPick2_MovZ : BOOL;
iPick2_Rot : BOOL; …Run Code Online (Sandbox Code Playgroud)