modbus-webserial / Smoke test (64 words / 64 bits)

Elapsed: 0 s

Loop interval: 1 s
  1. Holding registers (0 ā€“ 63)   0
  2.   ā€¢ FC 16 bulk-write 64 words 0…63
      ā€¢ FC 03 bulk-read verify
      ā€¢ FC 06 single-write each word (reverse order)
      ā€¢ FC 03 read back in 8-word chunks verify
  3. Input registers (0 ā€“ 63)   0
  4.   ā€¢ FC 04 one-shot read all 64
      ā€¢ FC 04 8-word chunk reads (8 Ć— 8)
      ā€¢ FC 04 64 single-word reads (1 Ć— 64) — compare all three results
  5. Coils (0 ā€“ 63)   0
  6.   ā€¢ FC 0F write-multiple T F T F … pattern
      ā€¢ FC 01 bulk-read verify pattern
      ā€¢ FC 05 toggle each coil individually
      ā€¢ FC 01 8-byte chunk reads verify new pattern
  7. Discrete inputs (0 ā€“ 63)   0
  8.   ā€¢ FC 02 one-shot read all 64
      ā€¢ FC 02 8-byte chunk reads (8 Ć— 8)
      ā€¢ FC 02 64 single-bit reads — compare all three results
Errors appear with their sub-step tag (e.g. ā€œ3-cā€), counters tick after each major step completes without error.
Example Arduino sketch  (ATmega32u4, 64 regs/64 bits)
#include <ModbusRTUSlave.h>

constexpr uint8_t  SLAVE_ID = 1;
constexpr uint32_t BAUD     = 9600;

/* 64-word / 64-bit data areas */
uint16_t holdingRegs[64];
uint16_t inputRegs  [64];
bool     coils      [64];
bool     discretes  [64];

ModbusRTUSlave mb(SLAVE_ID);

void setup() {
  Serial.begin(BAUD);
  while (!Serial) { }                 // wait for USB-CDC

  mb.configureHoldingRegisters(holdingRegs,  64);
  mb.configureInputRegisters  (inputRegs,    64);
  mb.configureCoils           (coils,        64);
  mb.configureDiscreteInputs  (discretes,    64);

  mb.begin(Serial, BAUD);
}

void loop() {
  mb.poll();                          // service Modbus RTU
}