Commit 33db1bd1 authored by Ivan Tyagov's avatar Ivan Tyagov

Increase modbus timeout as lime2 or network is too slow.

parent a8bc4204
__LOCATED_VAR(BOOL,__QX0_0_0_0,Q,X,0,0,0,0) __LOCATED_VAR(BOOL,__QX0_0_0_0,Q,X,0,0,0,0)
__LOCATED_VAR(BOOL,__QX0_0_0_0,Q,X,0,0,0,0)
__LOCATED_VAR(BOOL,__QX0_0_1_1,Q,X,0,0,1,1) __LOCATED_VAR(BOOL,__QX0_0_1_1,Q,X,0,0,1,1)
__LOCATED_VAR(BOOL,__QX0_0_2_2,Q,X,0,0,2,2) __LOCATED_VAR(BOOL,__QX0_0_2_2,Q,X,0,0,2,2)
__LOCATED_VAR(BOOL,__QX0_0_3_3,Q,X,0,0,3,3) __LOCATED_VAR(BOOL,__QX0_0_3_3,Q,X,0,0,3,3)
...@@ -263,22 +263,22 @@ static client_node_t client_nodes[NUMBER_OF_CLIENT_NODES] = { ...@@ -263,22 +263,22 @@ static client_node_t client_nodes[NUMBER_OF_CLIENT_NODES] = {
static client_request_t client_requests[NUMBER_OF_CLIENT_REQTS] = { static client_request_t client_requests[NUMBER_OF_CLIENT_REQTS] = {
/*request 0_0_0*/ /*request 0_0_0*/
{"0_0_0", 0, 0, req_output, 5, 0 , 1, {"0_0_0", 0, 0, req_output, 5, 0 , 1,
DEF_REQ_SEND_RETRIES, 0 /* mb_error_code */, 0 /* tn_error_code */, 0 /* prev_code */, {0, 10000000} /* timeout */, 0 /* write_on_change */, DEF_REQ_SEND_RETRIES, 0 /* mb_error_code */, 0 /* tn_error_code */, 0 /* prev_code */, {0, 30000000} /* timeout */, 0 /* write_on_change */,
{0}, {0}}, {0}, {0}},
/*request 0_0_1*/ /*request 0_0_1*/
{"0_0_1", 0, 0, req_output, 5, 1 , 1, {"0_0_1", 0, 0, req_output, 5, 1 , 1,
DEF_REQ_SEND_RETRIES, 0 /* mb_error_code */, 0 /* tn_error_code */, 0 /* prev_code */, {0, 10000000} /* timeout */, 0 /* write_on_change */, DEF_REQ_SEND_RETRIES, 0 /* mb_error_code */, 0 /* tn_error_code */, 0 /* prev_code */, {0, 30000000} /* timeout */, 0 /* write_on_change */,
{0}, {0}}, {0}, {0}},
/*request 0_0_2*/ /*request 0_0_2*/
{"0_0_2", 0, 0, req_output, 5, 2 , 1, {"0_0_2", 0, 0, req_output, 5, 2 , 1,
DEF_REQ_SEND_RETRIES, 0 /* mb_error_code */, 0 /* tn_error_code */, 0 /* prev_code */, {0, 10000000} /* timeout */, 0 /* write_on_change */, DEF_REQ_SEND_RETRIES, 0 /* mb_error_code */, 0 /* tn_error_code */, 0 /* prev_code */, {0, 30000000} /* timeout */, 0 /* write_on_change */,
{0}, {0}}, {0}, {0}},
/*request 0_0_3*/ /*request 0_0_3*/
{"0_0_3", 0, 0, req_output, 5, 3 , 1, {"0_0_3", 0, 0, req_output, 5, 3 , 1,
DEF_REQ_SEND_RETRIES, 0 /* mb_error_code */, 0 /* tn_error_code */, 0 /* prev_code */, {0, 10000000} /* timeout */, 0 /* write_on_change */, DEF_REQ_SEND_RETRIES, 0 /* mb_error_code */, 0 /* tn_error_code */, 0 /* prev_code */, {0, 30000000} /* timeout */, 0 /* write_on_change */,
{0}, {0}} {0}, {0}}
}; };
......
...@@ -204,10 +204,15 @@ void COUNTERST_init__(COUNTERST *data__, BOOL retain) { ...@@ -204,10 +204,15 @@ void COUNTERST_init__(COUNTERST *data__, BOOL retain) {
__INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain) __INIT_VAR(data__->EN,__BOOL_LITERAL(TRUE),retain)
__INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain) __INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
__INIT_VAR(data__->RESET,__BOOL_LITERAL(FALSE),retain) __INIT_VAR(data__->RESET,__BOOL_LITERAL(FALSE),retain)
__INIT_VAR(data__->OUT,0,retain) __INIT_VAR(data__->OUT1,0,retain)
__INIT_VAR(data__->CNT,0,retain) __INIT_VAR(data__->OUT0,0,retain)
__INIT_VAR(data__->CNT1,0,retain)
__INIT_VAR(data__->CNT0,0,retain)
__INIT_EXTERNAL(INT,RESETCOUNTERVALUE,data__->RESETCOUNTERVALUE,retain) __INIT_EXTERNAL(INT,RESETCOUNTERVALUE,data__->RESETCOUNTERVALUE,retain)
__INIT_EXTERNAL(BOOL,RELAY0VALUE,data__->RELAY0VALUE,retain) __INIT_EXTERNAL(BOOL,RELAY0VALUE,data__->RELAY0VALUE,retain)
__INIT_EXTERNAL(BOOL,RELAY1VALUE,data__->RELAY1VALUE,retain)
__INIT_EXTERNAL(BOOL,RELAY2VALUE,data__->RELAY2VALUE,retain)
__INIT_EXTERNAL(BOOL,RELAY3VALUE,data__->RELAY3VALUE,retain)
} }
// Code part // Code part
...@@ -223,11 +228,29 @@ void COUNTERST_body__(COUNTERST *data__) { ...@@ -223,11 +228,29 @@ void COUNTERST_body__(COUNTERST *data__) {
// Initialise TEMP variables // Initialise TEMP variables
if (__GET_VAR(data__->RESET,)) { if (__GET_VAR(data__->RESET,)) {
__SET_VAR(data__->,CNT,,__GET_EXTERNAL(data__->RESETCOUNTERVALUE,)); __SET_VAR(data__->,CNT0,,__GET_EXTERNAL(data__->RESETCOUNTERVALUE,));
__SET_VAR(data__->,CNT1,,__GET_EXTERNAL(data__->RESETCOUNTERVALUE,));
__SET_VAR(data__->,RESET,,__BOOL_LITERAL(FALSE));
} else {
__SET_VAR(data__->,CNT0,,(__GET_VAR(data__->CNT0,) + 1));
__SET_VAR(data__->,CNT1,,(__GET_VAR(data__->CNT1,) + 1));
if ((__GET_VAR(data__->CNT1,) > 100)) {
__SET_EXTERNAL(data__->,RELAY0VALUE,,__BOOL_LITERAL(FALSE));
__SET_EXTERNAL(data__->,RELAY1VALUE,,__BOOL_LITERAL(TRUE));
__SET_EXTERNAL(data__->,RELAY2VALUE,,__BOOL_LITERAL(FALSE));
__SET_EXTERNAL(data__->,RELAY3VALUE,,__BOOL_LITERAL(TRUE));
} else { } else {
__SET_VAR(data__->,CNT,,(__GET_VAR(data__->CNT,) + 1)); __SET_EXTERNAL(data__->,RELAY0VALUE,,__BOOL_LITERAL(TRUE));
__SET_EXTERNAL(data__->,RELAY1VALUE,,__BOOL_LITERAL(FALSE));
__SET_EXTERNAL(data__->,RELAY2VALUE,,__BOOL_LITERAL(TRUE));
__SET_EXTERNAL(data__->,RELAY3VALUE,,__BOOL_LITERAL(FALSE));
};
if ((__GET_VAR(data__->CNT1,) > 200)) {
__SET_VAR(data__->,CNT1,,0);
};
}; };
__SET_VAR(data__->,OUT,,__GET_VAR(data__->CNT,)); __SET_VAR(data__->,OUT1,,__GET_VAR(data__->CNT1,));
__SET_VAR(data__->,OUT0,,__GET_VAR(data__->CNT0,));
goto __end; goto __end;
...@@ -242,9 +265,8 @@ __end: ...@@ -242,9 +265,8 @@ __end:
void PLC_PRG_init__(PLC_PRG *data__, BOOL retain) { void PLC_PRG_init__(PLC_PRG *data__, BOOL retain) {
__INIT_VAR(data__->RESET,__BOOL_LITERAL(FALSE),retain) __INIT_VAR(data__->RESET,__BOOL_LITERAL(FALSE),retain)
__INIT_VAR(data__->CNT0,0,retain) __INIT_VAR(data__->CNT0,0,retain)
__INIT_VAR(data__->CNT1,0,retain)
COUNTERST_init__(&data__->COUNTERST0,retain); COUNTERST_init__(&data__->COUNTERST0,retain);
__INIT_LOCATED(BOOL,__QX0_0_0_0,data__->RELAY0VALUE,retain)
__INIT_LOCATED_VALUE(data__->RELAY0VALUE,__BOOL_LITERAL(FALSE))
} }
// Code part // Code part
...@@ -253,7 +275,8 @@ void PLC_PRG_body__(PLC_PRG *data__) { ...@@ -253,7 +275,8 @@ void PLC_PRG_body__(PLC_PRG *data__) {
__SET_VAR(data__->COUNTERST0.,RESET,,__GET_VAR(data__->RESET,)); __SET_VAR(data__->COUNTERST0.,RESET,,__GET_VAR(data__->RESET,));
COUNTERST_body__(&data__->COUNTERST0); COUNTERST_body__(&data__->COUNTERST0);
__SET_VAR(data__->,CNT0,,__GET_VAR(data__->COUNTERST0.OUT,)); __SET_VAR(data__->,CNT1,,__GET_VAR(data__->COUNTERST0.OUT1,));
__SET_VAR(data__->,CNT0,,__GET_VAR(data__->COUNTERST0.OUT0,));
goto __end; goto __end;
......
...@@ -107,12 +107,17 @@ typedef struct { ...@@ -107,12 +107,17 @@ typedef struct {
__DECLARE_VAR(BOOL,EN) __DECLARE_VAR(BOOL,EN)
__DECLARE_VAR(BOOL,ENO) __DECLARE_VAR(BOOL,ENO)
__DECLARE_VAR(BOOL,RESET) __DECLARE_VAR(BOOL,RESET)
__DECLARE_VAR(INT,OUT) __DECLARE_VAR(INT,OUT1)
__DECLARE_VAR(INT,OUT0)
// FB private variables - TEMP, private and located variables // FB private variables - TEMP, private and located variables
__DECLARE_VAR(INT,CNT) __DECLARE_VAR(INT,CNT1)
__DECLARE_VAR(INT,CNT0)
__DECLARE_EXTERNAL(INT,RESETCOUNTERVALUE) __DECLARE_EXTERNAL(INT,RESETCOUNTERVALUE)
__DECLARE_EXTERNAL(BOOL,RELAY0VALUE) __DECLARE_EXTERNAL(BOOL,RELAY0VALUE)
__DECLARE_EXTERNAL(BOOL,RELAY1VALUE)
__DECLARE_EXTERNAL(BOOL,RELAY2VALUE)
__DECLARE_EXTERNAL(BOOL,RELAY3VALUE)
} COUNTERST; } COUNTERST;
...@@ -125,10 +130,10 @@ typedef struct { ...@@ -125,10 +130,10 @@ typedef struct {
// PROGRAM Interface - IN, OUT, IN_OUT variables // PROGRAM Interface - IN, OUT, IN_OUT variables
__DECLARE_VAR(BOOL,RESET) __DECLARE_VAR(BOOL,RESET)
__DECLARE_VAR(INT,CNT0) __DECLARE_VAR(INT,CNT0)
__DECLARE_VAR(INT,CNT1)
// PROGRAM private variables - TEMP, private and located variables // PROGRAM private variables - TEMP, private and located variables
COUNTERST COUNTERST0; COUNTERST COUNTERST0;
__DECLARE_LOCATED(BOOL,RELAY0VALUE)
} PLC_PRG; } PLC_PRG;
......
...@@ -10,15 +10,20 @@ ...@@ -10,15 +10,20 @@
5;FB;CONFIG.RESOURCE1.INSTANCE0;CONFIG.RESOURCE1.INSTANCE0;PLC_PRG;; 5;FB;CONFIG.RESOURCE1.INSTANCE0;CONFIG.RESOURCE1.INSTANCE0;PLC_PRG;;
6;VAR;CONFIG.RESOURCE1.INSTANCE0.RESET;CONFIG.RESOURCE1.INSTANCE0.RESET;BOOL;BOOL; 6;VAR;CONFIG.RESOURCE1.INSTANCE0.RESET;CONFIG.RESOURCE1.INSTANCE0.RESET;BOOL;BOOL;
7;VAR;CONFIG.RESOURCE1.INSTANCE0.CNT0;CONFIG.RESOURCE1.INSTANCE0.CNT0;INT;INT; 7;VAR;CONFIG.RESOURCE1.INSTANCE0.CNT0;CONFIG.RESOURCE1.INSTANCE0.CNT0;INT;INT;
8;FB;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0;COUNTERST;; 8;VAR;CONFIG.RESOURCE1.INSTANCE0.CNT1;CONFIG.RESOURCE1.INSTANCE0.CNT1;INT;INT;
9;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.EN;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.EN;BOOL;BOOL; 9;FB;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0;COUNTERST;;
10;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.ENO;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.ENO;BOOL;BOOL; 10;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.EN;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.EN;BOOL;BOOL;
11;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RESET;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RESET;BOOL;BOOL; 11;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.ENO;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.ENO;BOOL;BOOL;
12;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.OUT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.OUT;INT;INT; 12;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RESET;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RESET;BOOL;BOOL;
13;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.CNT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.CNT;INT;INT; 13;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.OUT1;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.OUT1;INT;INT;
14;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RESETCOUNTERVALUE;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RESETCOUNTERVALUE;INT;INT; 14;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.OUT0;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.OUT0;INT;INT;
15;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY0VALUE;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY0VALUE;BOOL;BOOL; 15;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.CNT1;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.CNT1;INT;INT;
16;OUT;CONFIG.RESOURCE1.INSTANCE0.RELAY0VALUE;CONFIG.RESOURCE1.INSTANCE0.RELAY0VALUE;BOOL;BOOL; 16;VAR;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.CNT0;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.CNT0;INT;INT;
17;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RESETCOUNTERVALUE;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RESETCOUNTERVALUE;INT;INT;
18;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY0VALUE;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY0VALUE;BOOL;BOOL;
19;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY1VALUE;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY1VALUE;BOOL;BOOL;
20;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY2VALUE;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY2VALUE;BOOL;BOOL;
21;EXT;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY3VALUE;CONFIG.RESOURCE1.INSTANCE0.COUNTERST0.RELAY3VALUE;BOOL;BOOL;
// Ticktime // Ticktime
......
...@@ -3,23 +3,48 @@ FUNCTION_BLOCK CounterST ...@@ -3,23 +3,48 @@ FUNCTION_BLOCK CounterST
Reset : BOOL; Reset : BOOL;
END_VAR END_VAR
VAR_OUTPUT VAR_OUTPUT
Out : INT; Out1 : INT;
Out0 : INT;
END_VAR END_VAR
VAR VAR
Cnt : INT; Cnt1 : INT;
Cnt0 : INT;
END_VAR END_VAR
VAR_EXTERNAL VAR_EXTERNAL
ResetCounterValue : INT; ResetCounterValue : INT;
Relay0Value : BOOL; Relay0Value : BOOL;
Relay1Value : BOOL;
Relay2Value : BOOL;
Relay3Value : BOOL;
END_VAR END_VAR
IF Reset THEN IF Reset THEN
Cnt := ResetCounterValue; Cnt0 := ResetCounterValue;
Cnt1 := ResetCounterValue;
Reset := False;
ELSE
Cnt0 := Cnt0 + 1;
Cnt1 := Cnt1 + 1;
IF Cnt1 > 100 THEN
Relay0Value := False;
Relay1Value := True;
Relay2Value := False;
Relay3Value := True;
ELSE ELSE
Cnt := Cnt + 1; Relay0Value := True;
Relay1Value := False;
Relay2Value := True;
Relay3Value := False;
END_IF;
IF Cnt1>200 THEN
Cnt1 :=0;
END_IF; END_IF;
Out := Cnt; END_IF;
Out1 := Cnt1;
Out0 := Cnt0;
END_FUNCTION_BLOCK END_FUNCTION_BLOCK
PROGRAM plc_prg PROGRAM plc_prg
...@@ -28,16 +53,15 @@ PROGRAM plc_prg ...@@ -28,16 +53,15 @@ PROGRAM plc_prg
END_VAR END_VAR
VAR_OUTPUT VAR_OUTPUT
Cnt0 : INT; Cnt0 : INT;
Cnt1 : INT;
END_VAR END_VAR
VAR VAR
CounterST0 : CounterST; CounterST0 : CounterST;
END_VAR END_VAR
VAR
Relay0Value AT %QX0.0.0.0 : BOOL;
END_VAR
CounterST0(Reset := Reset); CounterST0(Reset := Reset);
Cnt0 := CounterST0.Out; Cnt1 := CounterST0.Out1;
Cnt0 := CounterST0.Out0;
END_PROGRAM END_PROGRAM
......
7ddbf3c64169e7bffe3e5184c847f848 fa65bfcf8872e8f43be080cb30776ced
\ No newline at end of file \ No newline at end of file
...@@ -97,23 +97,48 @@ FUNCTION_BLOCK CounterST ...@@ -97,23 +97,48 @@ FUNCTION_BLOCK CounterST
Reset : BOOL; Reset : BOOL;
END_VAR END_VAR
VAR_OUTPUT VAR_OUTPUT
Out : INT; Out1 : INT;
Out0 : INT;
END_VAR END_VAR
VAR VAR
Cnt : INT; Cnt1 : INT;
Cnt0 : INT;
END_VAR END_VAR
VAR_EXTERNAL VAR_EXTERNAL
ResetCounterValue : INT; ResetCounterValue : INT;
Relay0Value : BOOL; Relay0Value : BOOL;
Relay1Value : BOOL;
Relay2Value : BOOL;
Relay3Value : BOOL;
END_VAR END_VAR
IF Reset THEN IF Reset THEN
Cnt := ResetCounterValue; Cnt0 := ResetCounterValue;
Cnt1 := ResetCounterValue;
Reset := False;
ELSE
Cnt0 := Cnt0 + 1;
Cnt1 := Cnt1 + 1;
IF Cnt1 > 100 THEN
Relay0Value := False;
Relay1Value := True;
Relay2Value := False;
Relay3Value := True;
ELSE ELSE
Cnt := Cnt + 1; Relay0Value := True;
Relay1Value := False;
Relay2Value := True;
Relay3Value := False;
END_IF;
IF Cnt1>200 THEN
Cnt1 :=0;
END_IF; END_IF;
Out := Cnt; END_IF;
Out1 := Cnt1;
Out0 := Cnt0;
END_FUNCTION_BLOCK END_FUNCTION_BLOCK
PROGRAM plc_prg PROGRAM plc_prg
...@@ -122,16 +147,15 @@ PROGRAM plc_prg ...@@ -122,16 +147,15 @@ PROGRAM plc_prg
END_VAR END_VAR
VAR_OUTPUT VAR_OUTPUT
Cnt0 : INT; Cnt0 : INT;
Cnt1 : INT;
END_VAR END_VAR
VAR VAR
CounterST0 : CounterST; CounterST0 : CounterST;
END_VAR END_VAR
VAR
Relay0Value AT %QX0.0.0.0 : BOOL;
END_VAR
CounterST0(Reset := Reset); CounterST0(Reset := Reset);
Cnt0 := CounterST0.Out; Cnt1 := CounterST0.Out1;
Cnt0 := CounterST0.Out0;
END_PROGRAM END_PROGRAM
......
...@@ -26,7 +26,7 @@ void __publish_debug (void){} ...@@ -26,7 +26,7 @@ void __publish_debug (void){}
#include <stdio.h> #include <stdio.h>
#ifndef TARGET_ONLINE_DEBUG_DISABLE #ifndef TARGET_ONLINE_DEBUG_DISABLE
#define BUFFER_SIZE 20 #define BUFFER_SIZE 28
/* Atomically accessed variable for buffer state */ /* Atomically accessed variable for buffer state */
#define BUFFER_FREE 0 #define BUFFER_FREE 0
...@@ -69,14 +69,19 @@ static dbgvardsc_t dbgvardsc[] = { ...@@ -69,14 +69,19 @@ static dbgvardsc_t dbgvardsc[] = {
{&(CONFIG__RELAY3VALUE), BOOL_O_ENUM}, {&(CONFIG__RELAY3VALUE), BOOL_O_ENUM},
{&(RESOURCE1__INSTANCE0.RESET), BOOL_ENUM}, {&(RESOURCE1__INSTANCE0.RESET), BOOL_ENUM},
{&(RESOURCE1__INSTANCE0.CNT0), INT_ENUM}, {&(RESOURCE1__INSTANCE0.CNT0), INT_ENUM},
{&(RESOURCE1__INSTANCE0.CNT1), INT_ENUM},
{&(RESOURCE1__INSTANCE0.COUNTERST0.EN), BOOL_ENUM}, {&(RESOURCE1__INSTANCE0.COUNTERST0.EN), BOOL_ENUM},
{&(RESOURCE1__INSTANCE0.COUNTERST0.ENO), BOOL_ENUM}, {&(RESOURCE1__INSTANCE0.COUNTERST0.ENO), BOOL_ENUM},
{&(RESOURCE1__INSTANCE0.COUNTERST0.RESET), BOOL_ENUM}, {&(RESOURCE1__INSTANCE0.COUNTERST0.RESET), BOOL_ENUM},
{&(RESOURCE1__INSTANCE0.COUNTERST0.OUT), INT_ENUM}, {&(RESOURCE1__INSTANCE0.COUNTERST0.OUT1), INT_ENUM},
{&(RESOURCE1__INSTANCE0.COUNTERST0.CNT), INT_ENUM}, {&(RESOURCE1__INSTANCE0.COUNTERST0.OUT0), INT_ENUM},
{&(RESOURCE1__INSTANCE0.COUNTERST0.CNT1), INT_ENUM},
{&(RESOURCE1__INSTANCE0.COUNTERST0.CNT0), INT_ENUM},
{&(RESOURCE1__INSTANCE0.COUNTERST0.RESETCOUNTERVALUE), INT_P_ENUM}, {&(RESOURCE1__INSTANCE0.COUNTERST0.RESETCOUNTERVALUE), INT_P_ENUM},
{&(RESOURCE1__INSTANCE0.COUNTERST0.RELAY0VALUE), BOOL_P_ENUM}, {&(RESOURCE1__INSTANCE0.COUNTERST0.RELAY0VALUE), BOOL_P_ENUM},
{&(RESOURCE1__INSTANCE0.RELAY0VALUE), BOOL_O_ENUM} {&(RESOURCE1__INSTANCE0.COUNTERST0.RELAY1VALUE), BOOL_P_ENUM},
{&(RESOURCE1__INSTANCE0.COUNTERST0.RELAY2VALUE), BOOL_P_ENUM},
{&(RESOURCE1__INSTANCE0.COUNTERST0.RELAY3VALUE), BOOL_P_ENUM}
}; };
typedef void(*__for_each_variable_do_fp)(dbgvardsc_t*); typedef void(*__for_each_variable_do_fp)(dbgvardsc_t*);
......
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<ModbusRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" Write_on_change="false" SlaveID="0" Function="05 - Write Single coil"/> <ModbusRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" Write_on_change="false" SlaveID="0" Function="05 - Write Single coil" Timeout_in_ms="30"/>
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<ModbusRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" Function="05 - Write Single coil" Write_on_change="false" Start_Address="1" SlaveID="0"/> <ModbusRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" Function="05 - Write Single coil" Write_on_change="false" Start_Address="1" SlaveID="0" Timeout_in_ms="30"/>
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<ModbusRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" Function="05 - Write Single coil" Start_Address="2" SlaveID="0"/> <ModbusRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" Function="05 - Write Single coil" Start_Address="2" SlaveID="0" Timeout_in_ms="30"/>
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<ModbusRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" Function="05 - Write Single coil" SlaveID="0" Start_Address="3"/> <ModbusRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" Function="05 - Write Single coil" SlaveID="0" Start_Address="3" Timeout_in_ms="30"/>
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201"> <project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2021-05-14T14:33:11"/> <fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2021-05-14T14:33:11"/>
<contentHeader name="Counter (OSIE)" modificationDateTime="2021-05-19T14:06:39"> <contentHeader name="Counter (OSIE)" modificationDateTime="2021-05-21T15:25:57">
<coordinateInfo> <coordinateInfo>
<fbd> <fbd>
<scaling x="0" y="0"/> <scaling x="0" y="0"/>
...@@ -32,22 +32,17 @@ ...@@ -32,22 +32,17 @@
<INT/> <INT/>
</type> </type>
</variable> </variable>
</outputVars> <variable name="Cnt1">
<localVars>
<variable name="CounterST0">
<type> <type>
<derived name="CounterST"/> <INT/>
</type> </type>
</variable> </variable>
</localVars> </outputVars>
<localVars> <localVars>
<variable name="Relay0Value" address="%QX0.0.0.0"> <variable name="CounterST0">
<type> <type>
<BOOL/> <derived name="CounterST"/>
</type> </type>
<documentation>
<xhtml:p><![CDATA[Relay 0 Status]]></xhtml:p>
</documentation>
</variable> </variable>
</localVars> </localVars>
</interface> </interface>
...@@ -56,7 +51,7 @@ ...@@ -56,7 +51,7 @@
<comment localId="1" height="143" width="201"> <comment localId="1" height="143" width="201">
<position x="566" y="75"/> <position x="566" y="75"/>
<content> <content>
<xhtml:p><![CDATA[Test Ivan: this PLC will run an increasing counter unless a Reset is switched On (then counter will be reset).]]></xhtml:p> <xhtml:p><![CDATA[Test Ivan: this PLC will switch ON / OFF attached over modbus relays {0..3} of a Lime2 coupler.]]></xhtml:p>
</content> </content>
</comment> </comment>
<block localId="2" typeName="CounterST" instanceName="CounterST0" executionOrderId="0" height="109" width="99"> <block localId="2" typeName="CounterST" instanceName="CounterST0" executionOrderId="0" height="109" width="99">
...@@ -64,41 +59,59 @@ ...@@ -64,41 +59,59 @@
<inputVariables> <inputVariables>
<variable formalParameter="Reset"> <variable formalParameter="Reset">
<connectionPointIn> <connectionPointIn>
<relPosition x="0" y="64"/> <relPosition x="0" y="42"/>
<connection refLocalId="3"> <connection refLocalId="3">
<position x="288" y="256"/> <position x="288" y="234"/>
<position x="229" y="256"/> <position x="258" y="234"/>
<position x="258" y="218"/>
<position x="231" y="218"/>
</connection> </connection>
</connectionPointIn> </connectionPointIn>
</variable> </variable>
</inputVariables> </inputVariables>
<inOutVariables/> <inOutVariables/>
<outputVariables> <outputVariables>
<variable formalParameter="Out"> <variable formalParameter="Out1">
<connectionPointOut>
<relPosition x="99" y="42"/>
</connectionPointOut>
</variable>
<variable formalParameter="Out0">
<connectionPointOut> <connectionPointOut>
<relPosition x="99" y="64"/> <relPosition x="99" y="86"/>
</connectionPointOut> </connectionPointOut>
</variable> </variable>
</outputVariables> </outputVariables>
</block> </block>
<inVariable localId="3" executionOrderId="0" height="24" width="50" negated="false"> <inVariable localId="3" executionOrderId="0" height="24" width="50" negated="false">
<position x="179" y="244"/> <position x="181" y="206"/>
<connectionPointOut> <connectionPointOut>
<relPosition x="50" y="12"/> <relPosition x="50" y="12"/>
</connectionPointOut> </connectionPointOut>
<expression>Reset</expression> <expression>Reset</expression>
</inVariable> </inVariable>
<outVariable localId="4" executionOrderId="0" height="24" width="42" negated="false"> <outVariable localId="4" executionOrderId="0" height="24" width="42" negated="false">
<position x="450" y="244"/> <position x="433" y="266"/>
<connectionPointIn> <connectionPointIn>
<relPosition x="0" y="12"/> <relPosition x="0" y="12"/>
<connection refLocalId="2" formalParameter="Out"> <connection refLocalId="2" formalParameter="Out0">
<position x="450" y="256"/> <position x="433" y="278"/>
<position x="387" y="256"/> <position x="387" y="278"/>
</connection> </connection>
</connectionPointIn> </connectionPointIn>
<expression>Cnt0</expression> <expression>Cnt0</expression>
</outVariable> </outVariable>
<outVariable localId="6" executionOrderId="0" height="24" width="42" negated="false">
<position x="435" y="222"/>
<connectionPointIn>
<relPosition x="0" y="12"/>
<connection refLocalId="2" formalParameter="Out1">
<position x="435" y="234"/>
<position x="387" y="234"/>
</connection>
</connectionPointIn>
<expression>Cnt1</expression>
</outVariable>
</FBD> </FBD>
</body> </body>
</pou> </pou>
...@@ -112,14 +125,24 @@ ...@@ -112,14 +125,24 @@
</variable> </variable>
</inputVars> </inputVars>
<outputVars> <outputVars>
<variable name="Out"> <variable name="Out1">
<type>
<INT/>
</type>
</variable>
<variable name="Out0">
<type> <type>
<INT/> <INT/>
</type> </type>
</variable> </variable>
</outputVars> </outputVars>
<localVars> <localVars>
<variable name="Cnt"> <variable name="Cnt1">
<type>
<INT/>
</type>
</variable>
<variable name="Cnt0">
<type> <type>
<INT/> <INT/>
</type> </type>
...@@ -136,17 +159,52 @@ ...@@ -136,17 +159,52 @@
<BOOL/> <BOOL/>
</type> </type>
</variable> </variable>
<variable name="Relay1Value">
<type>
<BOOL/>
</type>
</variable>
<variable name="Relay2Value">
<type>
<BOOL/>
</type>
</variable>
<variable name="Relay3Value">
<type>
<BOOL/>
</type>
</variable>
</externalVars> </externalVars>
</interface> </interface>
<body> <body>
<ST> <ST>
<xhtml:p><![CDATA[IF Reset THEN <xhtml:p><![CDATA[IF Reset THEN
Cnt := ResetCounterValue; Cnt0 := ResetCounterValue;
Cnt1 := ResetCounterValue;
Reset := False;
ELSE ELSE
Cnt := Cnt + 1; Cnt0 := Cnt0 + 1;
Cnt1 := Cnt1 + 1;
IF Cnt1 > 100 THEN
Relay0Value := False;
Relay1Value := True;
Relay2Value := False;
Relay3Value := True;
ELSE
Relay0Value := True;
Relay1Value := False;
Relay2Value := True;
Relay3Value := False;
END_IF;
IF Cnt1>200 THEN
Cnt1 :=0;
END_IF;
END_IF; END_IF;
Out := Cnt;]]></xhtml:p> Out1 := Cnt1;
Out0 := Cnt0;]]></xhtml:p>
</ST> </ST>
</body> </body>
</pou> </pou>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment