title: How to access 5xxxx Modbus address
body: <p>I am trying to access addresses such as 50526 on a Socomec Diris A40 using nmodbus. Unlike other examples I have seen which start with 3 or 4, these addresses all start with a 5. 50544, 50550, 50556 are but a few more im intersted in.</p>
  
  <p>As far as I understand it at the moment, the first number represents the Modbus function and does not actually refer to the real address, i.e. 30000 addresses use function 04, 40000 addresses function 03 (?). I have seen the first digit omitted and the rest used as the address. If I try this with my 50000 addresses I get some success, but not with all values and the results dont seem correct. MODPOLL returns the same results as my code.</p>
  
  <p>I could really use some help! If anyone can advise me on how to access these 5xxxx registers, I would be extremely grateful.</p>
  
  <p>Method code:</p>
  
  <pre><code>    public static void ModbusSerialRtuMasterReadRegisters()
      {
          using (SerialPort port = new SerialPort("COM1"))
          {
              // configure serial port
  
              port.BaudRate = 9600;
              port.DataBits = 8;
              port.Parity = Parity.None;
              port.StopBits = StopBits.One;
  
              try
              {
                  port.Open();
                  Console.WriteLine("port " + port.PortName + " open: " + port.IsOpen + "\n");
              }
              catch(Exception ex)
              {
                  Console.WriteLine("Unable to open port: " + ex);
              }
  
              // create modbus master
              IModbusSerialMaster master = ModbusSerialMaster.CreateRtu(port);
  
              byte slaveId = 1;
              ushort startAddress = 1;
              ushort numRegisters = 5;
              ushort[] registers = new ushort[numRegisters];;
  
              // read registers
              try
              {
                  registers = master.ReadHoldingRegisters(slaveId, startAddress, numRegisters);
                  for (int i = 0; i &lt; numRegisters; i++)
                      Console.WriteLine("Register {0}={1}", startAddress + i, registers[i]);
              }
              catch (Modbus.SlaveException se)
              {
                  Console.WriteLine("Could not find register... \n \n" + se);
              }
  
              try
              {
                  port.Close();
                  Console.WriteLine("\nport " + port.PortName + " open: " + port.IsOpen + "\n");
              }
              catch (Exception ex)
              {
                  Console.WriteLine("Unable to close port: " + ex);
              }
          }
  </code></pre>