ChatGPT Fails: 39999 is not a Modbus Holding Register

Example of a ChatGPT fail!

  • The starting address in Modbus notation would be 39999. WRONG!!!

In our interactions with ChatGPT, it's not uncommon to encounter inaccuracies or be presented with the wrong information. Despite its advanced capabilities, ChatGPT is prone to errors that could have dire consequences if the information is not verified.

Modbus Holding Registers Image
Form a Modbus Message to read 10 Registers

Modbus messages consist of several elements, including the function code, starting address, number of registers, and error-checking information. The Modbus protocol supports various function codes for different operations. Reading registers is typically done using Function Code 03 (Read Analog Output Holding Registers) or Function Code 04 (Read Analog Input Registers).

Assuming you want to read 10 registers starting from address 40001 (4xxxx in Modbus notation), you would use Function Code 03 or 04 and construct the message as follows:

Let's assume you want to read from Modbus slave device with address 1.

  1. Function Code:
    • Use Function Code 03 for reading Holding Registers or Function Code 04 for reading Input Registers.
    • For Function Code 03 (Read Analog Output Holding Registers):
    • For Function Code 04 (Read Analog Input Registers):
  2. Starting Address:
    • Since you want to read from address 4xxxx, subtract 1 to convert it to Modbus address.
    • The starting address in Modbus notation would be 39999. WRONG!
    • Convert this address to two bytes (16 bits) for Modbus:
  3. Number of Registers:
    • You want to read 10 registers.
  4. Checksum (CRC):
    • Calculate the CRC (Cyclic Redundancy Check) for error-checking.
    • For example, if the previous bytes are represented as an array [0x03, 0x9C, 0x3F, 0x00, 0x0A], you would calculate the CRC.
  5. Complete Message:
    • Combine all the elements to form the complete Modbus message.

      JavaScript ChatGPT suggestion

      Replace each field with the corresponding values. For example, if your slave address is 1:

      	csharp ChatGPT suggestion

Note: The CRC calculation is a crucial step for error-checking in Modbus. Be sure to use a CRC calculation algorithm or a tool to compute the CRC values accurately.

Contact Us

Contact us via phone (+1 866-383-1657) or leave a detailed message below for sales, support, or any other needs

*Required Field
*Required Field
I'd like to receive the newsletter. *Check email for confirmation.
*Required Field
8:00am - 12:00pm 12:00pm - 5:00pm