modbus instruction format 16 $ 10

 { 
   // Write plurality of requests 01 (slave) 10 (Function Code) 0077 (start address) 00 01 (number of registers) 05 55 (write data) 02 (bytes) 6F B8 (the CRC) 
  // 01 write a plurality of return (slave) 10 (function code) 0077 (start address) 00 01 (number of registers) the CRC B1 D3) 
  // 01 read a plurality of requests (slave) 03 (function code) 0077 ( start address) 00 01 (number of registers) 34 is 10 (the CRC) 
  // 01 reads a plurality of return (slave) 03 (function code) 02 (the number of data field bytes) 0555 (specific data) 7b 2b (CRC) 
   } 

 { var 
        buf: Array [0..3] of byte; 
        Pint: PInteger; 
      the begin 
        buf [0]: = $ 00; // low bit 
        buf [. 1]: = $ 01; 
        buf [2]: = $ 02; 
        buf [ 3]: = $ 03; // highest 
        Pint: @ = buf [0]; 
        the ShowMessage (the IntToStr (Pint ^)); 
      End; } 
      { var 
        buf: Array [0..1] of byte;
        PINT: PSmallInt; 
      the begin 
        buf [0]: = $ the FF; // low bit 
        buf [1]: = $ FF ; // highest 
        PINT: @buf = [0]; 
        the ShowMessage (the IntToStr (Pint ^)); 
      End ; 
      }

Guess you like

Origin www.cnblogs.com/tobetterlife/p/12161618.html