modbus/mb_runtime.h
changeset 2721 367eb26972b1
parent 2715 1215a6b741d5
child 2722 5d72a52b8f9c
equal deleted inserted replaced
2717:b3b6991f1cb6 2721:367eb26972b1
    39 typedef struct{
    39 typedef struct{
    40 	    u16		ro_bits [MEM_AREA_SIZE];
    40 	    u16		ro_bits [MEM_AREA_SIZE];
    41 	    u16		rw_bits [MEM_AREA_SIZE];
    41 	    u16		rw_bits [MEM_AREA_SIZE];
    42 	    u16		ro_words[MEM_AREA_SIZE];
    42 	    u16		ro_words[MEM_AREA_SIZE];
    43 	    u16		rw_words[MEM_AREA_SIZE];
    43 	    u16		rw_words[MEM_AREA_SIZE];
       
    44             /* Two flags to count the number of Modbus requests (read and write) we have 
       
    45              * successfully received from any remote Modbus master
       
    46              * These two flags will be mapped onto located variables
       
    47              * so the user's IEC 61131-3 code can check whether we are being
       
    48              * polled by a Modbus master.
       
    49              * The counters will roll over to 0 upon reaching maximum value.
       
    50              */
       
    51             u32         flag_write_req_counter;
       
    52             u32         flag_read_req_counter;
    44 	} server_mem_t;
    53 	} server_mem_t;
    45 
    54 
    46 
    55 
    47 /*
    56 /*
    48  * Beremiz has a program to run on the PLC (Beremiz_service.py)
    57  * Beremiz has a program to run on the PLC (Beremiz_service.py)
    87               char  str2[MODBUS_PARAM_STRING_SIZE]; 
    96               char  str2[MODBUS_PARAM_STRING_SIZE]; 
    88 	    u8		slave_id;
    97 	    u8		slave_id;
    89 	    node_addr_t	node_address;
    98 	    node_addr_t	node_address;
    90 	    int		mb_nd;      // modbus library node used for this server 
    99 	    int		mb_nd;      // modbus library node used for this server 
    91 	    int		init_state; // store how far along the server's initialization has progressed
   100 	    int		init_state; // store how far along the server's initialization has progressed
       
   101             /* entries from this point forward are not statically initialized when the variable is declared */
       
   102             /* they will be initialized by the  code itself in the init() function */
    92 	    pthread_t	thread_id;  // thread handling this server
   103 	    pthread_t	thread_id;  // thread handling this server
    93 	    server_mem_t	mem_area;
   104 	    server_mem_t	mem_area;
    94 	} server_node_t;
   105 	} server_node_t;
    95 
   106 
    96 
   107