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 WAGO 753-483 Module. The Ethernet Connection is working via a WAGO Ethernet Controller 750-881. 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).
When I use this tool and when I request Read Discrete Inputs - FC2, FC3 and FC4 I get:
The function has to be inserted code, which limits the use of libraries. I have given the following variables with the addresses:
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
A given function to write a voltage of a analog output would be:
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 & 0xFF;
HighByte = (register_val_voltage >> 8) & 0xFF;
CellWrite[10]=HighByte;
CellWrite[11]=LowByte;
TcpSend(gConnectionSocket,CellWrite,elcount(CellWrite)); //TcpSend(TCP-Socketname, Modbusprotokoll as Array, Array-size)
write("Voltage Data sent");
return;
}
How can I read the information of the Analog Input from Read_AI
?
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.