Hello,
I am trying to get data from Input holding registers from a PLC through ModbusTCP communication. I have added the ModbusTCP driver to MainForm.cs and have set the IP address.
I have two digital panel meters in the MainForm. If I set the "PLCAddressValue" property for these components and run the applications, I get the data just fine. However, the Incoming data has to be modified before it is displayed on the meter. For this purpose, I am exploring the DataSubscriber
I understand that Data subscriber automatically refreshes the data values. Thus, this avoids calling modbusTCPCom1.BeginRead("address")
repeatedly.
I want to subscribe to 8 consecutive registers. Their addresses are as follows: 40001 to 40008. How can get the values of these registers using data subscriber? I have gone through few posts and have this so far
private void MainForm_Load(object sender, EventArgs e)
{
Int val1 = modbusTCPCom1.Subscribe("40001",1,100, SubscribeCallBack);
}
Question 1: How can I read/store values of all registers into an integer array and read individual values later? Do I need an individual subscription for each of those registers?
Question 2: What should the "SubscribeCallBack" event include to handle communication lost to PLC?
Question 3: What is the difference between DataSubscriber and DataSubscriber2?