I was just trying, and it worked perfectly. Are you sure about connection parameter (Baudrate, Parity, stopbits)?
But your while loop does not work, because you are casting a bool value to a string, and then compare. But the .ToString returns "False" if the coil turned to zero (Note the Capital letter "F".
But it would be better to compare the "bool" value:
bool teste = true;
while (teste != false)
{
......
teste = modbusClient.ReadCoils(11264,1)[0];
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
View and moderate all "General Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Discussion"
I want to perform the status of a digital input, but the value that returns is false.
Coil value # I1: is always True
The sample code:
Hi!
I was just trying, and it worked perfectly. Are you sure about connection parameter (Baudrate, Parity, stopbits)?
But your while loop does not work, because you are casting a bool value to a string, and then compare. But the .ToString returns "False" if the coil turned to zero (Note the Capital letter "F".
But it would be better to compare the "bool" value:
bool teste = true;
while (teste != false)
{
......
teste = modbusClient.ReadCoils(11264,1)[0];
}