modbus/mb_runtime.h
changeset 2722 5d72a52b8f9c
parent 2721 367eb26972b1
child 2723 cde2e410b874
equal deleted inserted replaced
2721:367eb26972b1 2722:5d72a52b8f9c
    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 
    44             /* Two flags to count the number of Modbus requests (read and write) we have 
    45              * successfully received from any remote Modbus master
    45              * successfully received from any remote Modbus master.
    46              * These two flags will be mapped onto located variables
    46              * Two boolean flags that are set whenever we successfully process a
       
    47              * Modbus request sent from a remote client.
       
    48              * These flags will be mapped onto located variables
    47              * so the user's IEC 61131-3 code can check whether we are being
    49              * so the user's IEC 61131-3 code can check whether we are being
    48              * polled by a Modbus master.
    50              * polled by a Modbus master.
    49              * The counters will roll over to 0 upon reaching maximum value.
    51              * The counters will roll over to 0 upon reaching maximum value.
       
    52              * The user will probably periodically reset the boolean flags to false,
       
    53              * and use this as a communication timeout 
       
    54              * (when it remains false in two consecutive periods)
       
    55              * 
       
    56              * u8  for BOOL  variable/flag
       
    57              * u32 for UDINT variable/counter
    50              */
    58              */
    51             u32         flag_write_req_counter;
    59         u8   flag_write_req_flag;
    52             u32         flag_read_req_counter;
    60         u8   flag_read_req_flag;
       
    61         u32  flag_write_req_counter;
       
    62         u32  flag_read_req_counter;
    53 	} server_mem_t;
    63 	} server_mem_t;
    54 
    64 
    55 
    65 
    56 /*
    66 /*
    57  * Beremiz has a program to run on the PLC (Beremiz_service.py)
    67  * Beremiz has a program to run on the PLC (Beremiz_service.py)