modbus/mb_runtime.h
changeset 2714 0b636dc947a2
parent 2713 680ea4684209
child 2715 1215a6b741d5
equal deleted inserted replaced
2713:680ea4684209 2714:0b636dc947a2
   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         u16     flag_exec_started;  
   174           /* flag that will be mapped onto a (WORD) located variable 
   174           /* flag that will be mapped onto a (BYTE) located variable 
   175            * (u16 because the flag is a word! )
   175            * (u8 because the flag is a BYTE! )
   176            *    -> MSByte 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
   179            *         3 -> server did not reply before timeout expired
   179            *         3 -> server did not reply before timeout expired
   180            *         4 -> server returned a valid Modbus error frame
   180            *         4 -> server returned a valid Modbus error frame
   181            *    -> if the MSByte is 4, the LSByte will store the MB error code returned by the server
       
   182            *    -> will be reset (set to 0) once this MB transaction has completed sucesfully
   181            *    -> will be reset (set to 0) once this MB transaction has completed sucesfully
   183            * 
   182            * 
   184            * In other words, this variable will be set from the current status of the
   183            * In other words, this variable is a copy of tn_error_code, reset after each request attempt completes.
   185            * mb_error_code and tn_error_code flags after each request.
   184            * We map this copy (instead of tn_error_code) onto a located variable in case the user program decides
   186            */
   185            * to overwrite its value and mess up the plugin logic.
   187         u16     flag_exec_status;  
   186            */
       
   187         u8      flag_tn_error_code;  
       
   188           /* flag that will be mapped onto a (BYTE) located variable 
       
   189            * (u8 because the flag is a BYTE! )
       
   190            *    -> if flag_tn_error_code is 4, this flag will store the MB error code returned by the MB server in a MB error frame
       
   191            *    -> will be reset (set to 0) once this MB transaction has completed succesfully
       
   192            * 
       
   193            * In other words, this variable is a copy of mb_error_code, reset after each request attempt completes.
       
   194            * We map this copy (instead of mb_error_code) onto a located variable in case the user program decides
       
   195            * to overwrite its value and mess up the plugin logic.
       
   196            */
       
   197         u8      flag_mb_error_code;  
   188 	} client_request_t;
   198 	} client_request_t;
   189 
   199 
   190 
   200 
   191 /* The total number of nodes, needed to support _all_ instances of the modbus plugin */
   201 /* The total number of nodes, needed to support _all_ instances of the modbus plugin */
   192 #define TOTAL_TCPNODE_COUNT       %(total_tcpnode_count)s
   202 #define TOTAL_TCPNODE_COUNT       %(total_tcpnode_count)s