title: Read Analog Input via Modbus TCP
body: <p>I want to read a Analog Input via Modbus TCP from a WAGO AI. The input I am trying to read is connected via a <a href="https://www.wago.com/global/i-o-systems/2-channel-analog-input/p/753-483" rel="nofollow noreferrer">WAGO 753-483 Module</a>. The Ethernet Connection is working via a <a href="https://www.wago.com/global/plcs-%E2%80%93-controllers/controller-ethernet/p/750-881#downloads" rel="nofollow noreferrer">WAGO Ethernet Controller 750-881</a>. From the documentation I believe that the Voltage should be in input register 29 however the voltage is not switching between ~10V and nearly 0 (which indicates a state that I want to read in). According to my documentation the last two bytes are the High-Byte Data (10) and Low-Byte Data (11).</p>
  <p>When I use <a href="http://easymodbustcp.net/en/" rel="nofollow noreferrer">this tool</a> and when I request Read Discrete Inputs - FC2, FC3 and FC4 I get:</p>
  <p><a href="https://i.stack.imgur.com/BsX0e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BsX0e.png" alt="enter image description here" /></a></p>
  <p>The function has to be inserted code, which limits the use of libraries. I have given the following variables with the addresses:</p>
  <pre><code> byte Read_AI[12]= {0,0,0,0,0,6,1,4,0,29,0,0};       //read Holding register of address 29??
   byte Cell_02_write[12]= {0,0,0,0,0,6,1,6,0,1,0,0};        //write value at address 1
  </code></pre>
  <p>A given function to write a voltage of a analog output would be:</p>
  <pre><code>gConnectionSocket = TcpOpen(clientIpAddress,33333); //open socket
  
  void sendCellData(double CellV, byte CellWrite[])
  {
    register_val_voltage = (CellV*32767)/10;              //value for register [ x = (CellVoltage * 32767)/10 ] 
    LowByte = register_val_voltage &amp; 0xFF;                
    HighByte = (register_val_voltage &gt;&gt; 8) &amp; 0xFF;        
    CellWrite[10]=HighByte;
    CellWrite[11]=LowByte;
    TcpSend(gConnectionSocket,CellWrite,elcount(CellWrite)); //TcpSend(TCP-Socketname, Modbusprotokoll as Array, Array-size) 
    write(&quot;Voltage Data sent&quot;); 
   
    return; 
  }
  </code></pre>
  <p>How can I read the information of the Analog Input from <code>Read_AI</code>?</p>
  <p>I hope someone can help me and I know this is very limited information as I don't have a lot knowledge in Modbus-TCP.</p>