modbus/mb_runtime.h
changeset 2713 680ea4684209
parent 2655 d2b2ee04bfa1
child 2714 0b636dc947a2
equal deleted inserted replaced
2667:253110ba0fd7 2713:680ea4684209
   145 	    iotype_t	req_type;
   145 	    iotype_t	req_type;
   146 	    u8		mb_function;
   146 	    u8		mb_function;
   147 	    u16		address;
   147 	    u16		address;
   148 	    u16		count;
   148 	    u16		count;
   149 	    int		retries;
   149 	    int		retries;
   150 	    u8		error_code; // modbus error code (if any) of current request
   150 	    u8		mb_error_code; // modbus      error code (if any) of last executed request
       
   151 	    u8		tn_error_code; // transaction error code (if any) of last executed request
   151 	    int		prev_error; // error code of the last printed error message (0 when no error) 
   152 	    int		prev_error; // error code of the last printed error message (0 when no error) 
   152 	    struct timespec resp_timeout;
   153 	    struct timespec resp_timeout;
   153 	    u8		write_on_change; // boolean flag. If true => execute MB request when data to send changes
   154 	    u8		write_on_change; // boolean flag. If true => execute MB request when data to send changes
   154 	      // buffer used to store located PLC variables
   155 	      // buffer used to store located PLC variables
   155 	    u16		plcv_buffer[REQ_BUF_SIZE];
   156 	    u16		plcv_buffer[REQ_BUF_SIZE];
   174            * (u16 because the flag is a word! )
   175            * (u16 because the flag is a word! )
   175            *    -> MSByte will store the result of the last executed MB transaction
   176            *    -> MSByte will store the result of the last executed MB transaction
   176            *         1 -> error accessing IP network, or serial interface
   177            *         1 -> error accessing IP network, or serial interface
   177            *         2 -> reply received from server was an invalid frame
   178            *         2 -> reply received from server was an invalid frame
   178            *         3 -> server did not reply before timeout expired
   179            *         3 -> server did not reply before timeout expired
   179            *         4 -> server returned a valid error frame
   180            *         4 -> server returned a valid Modbus error frame
   180            *    -> if the MSByte is 4, the LSByte will store the MB error code returned by the server
   181            *    -> if the MSByte is 4, the LSByte will store the MB error code returned by the server
   181            *    -> will be reset (set to 0) once this MB transaction has completed sucesfully
   182            *    -> will be reset (set to 0) once this MB transaction has completed sucesfully
       
   183            * 
       
   184            * In other words, this variable will be set from the current status of the
       
   185            * mb_error_code and tn_error_code flags after each request.
   182            */
   186            */
   183         u16     flag_exec_status;  
   187         u16     flag_exec_status;  
   184 	} client_request_t;
   188 	} client_request_t;
   185 
   189 
   186 
   190