156 u16 plcv_buffer[REQ_BUF_SIZE]; |
156 u16 plcv_buffer[REQ_BUF_SIZE]; |
157 // buffer used to store data coming from / going to server |
157 // buffer used to store data coming from / going to server |
158 u16 coms_buffer[REQ_BUF_SIZE]; |
158 u16 coms_buffer[REQ_BUF_SIZE]; |
159 pthread_mutex_t coms_buf_mutex; // mutex to access coms_buffer[] |
159 pthread_mutex_t coms_buf_mutex; // mutex to access coms_buffer[] |
160 /* boolean flag that will be mapped onto a (BOOL) located variable |
160 /* boolean flag that will be mapped onto a (BOOL) located variable |
161 * (u16 because IEC 61131-3 BOOL are mapped onto u16 in C code! ) |
161 * (u8 because IEC 61131-3 BOOL are mapped onto u8 in C code! ) |
162 * -> allow PLC program to request when to start the MB transaction |
162 * -> allow PLC program to request when to start the MB transaction |
163 * -> will be reset once the MB transaction has completed |
163 * -> will be reset once the MB transaction has completed |
164 */ |
164 */ |
165 u16 flag_exec_req; |
165 u8 flag_exec_req; |
166 /* flag that works in conjunction with flag_exec_req |
166 /* flag that works in conjunction with flag_exec_req |
167 * (does not really need to be u16 as it is not mapped onto a located variable. ) |
167 * (does not really need to be u8 as it is not mapped onto a located variable. ) |
168 * -> used by internal logic to indicate that the client thread |
168 * -> used by internal logic to indicate that the client thread |
169 * that will be executing the MB transaction |
169 * that will be executing the MB transaction |
170 * requested by flag exec_req has already been activated. |
170 * requested by flag exec_req has already been activated. |
171 * -> will be reset once the MB transaction has completed |
171 * -> will be reset once the MB transaction has completed |
172 */ |
172 */ |
173 u16 flag_exec_started; |
173 u8 flag_exec_started; |
174 /* flag that will be mapped onto a (BYTE) located variable |
174 /* flag that will be mapped onto a (BYTE) located variable |
175 * (u8 because the flag is a BYTE! ) |
175 * (u8 because the flag is a BYTE! ) |
176 * -> will store the result of the last executed MB transaction |
176 * -> will store the result of the last executed MB transaction |
177 * 1 -> error accessing IP network, or serial interface |
177 * 1 -> error accessing IP network, or serial interface |
178 * 2 -> reply received from server was an invalid frame |
178 * 2 -> reply received from server was an invalid frame |