Hi! Im
Im trying to read a some 32-bit registers from a PLC and check if a bit is set. If e.g bit number 8 is set then i have an alarm. If bit 9 is set then it is acknowledged. If there is an alarm i would like to present this alarm with name and value in a list. The program should read through these registers continuously and always check the bits.
Can someone show me an example of this? Is it best to dedicate a own thread for this or what? Should i use windows forms or WPF?
The code below reads register 40-44 and writes the binary values to console.
try
{
//read register 40-44 and put the values into read array.
int[] read = connection.PcdRdRTC('R', 6000, 5);
int bin = 2;
for (int i = 0; i < read.Length; i++)
Console.Write("Reg {0}: {1} ", i + 40, Convert.ToString(read[i], bin) + "\n");
Console.WriteLine();
}
Hope someone can help me in the right direction.
Best regards