From a38e976bb2788890bf12f6a528ba87f422be3f77 Mon Sep 17 00:00:00 2001 From: Stéphane Raimbault Date: Wed, 6 Aug 2008 23:22:05 +0200 Subject: [PATCH] Reduce the length defined for the shortest query and add better comment. --- modbus/modbus.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modbus/modbus.h b/modbus/modbus.h index 4013baf..03af42d 100644 --- a/modbus/modbus.h +++ b/modbus/modbus.h @@ -39,8 +39,16 @@ extern "C" { #define CHECKSUM_LENGTH_RTU 2 #define CHECKSUM_LENGTH_TCP 0 -/* 8 + HEADER_LENGTH_TCP */ -#define MIN_QUERY_LENGTH 14 +/* It's not really the minimal length (the real one is report slave ID + * in RTU (4 bytes)) but it's a convenient size to use in RTU or TCP + * communications to read many values or write a single one. + * Maximum between : + * - HEADER_LENGTH_TCP (6) + slave (1) + function (1) + address (2) + + * number (2) + * - HEADER_LENGTH_RTU (0) + slave (1) + function (1) + address (2) + + * number (2) + CRC (2) +*/ +#define MIN_QUERY_LENGTH 12 /* Page 102, Application Notes of PI–MBUS–300: * The maximum length of the entire message must not exceed 256 -- libgit2 0.21.4