Aggiunto test lettura REAL

This commit is contained in:
Samuele Locatelli
2020-05-12 11:32:41 +02:00
parent a69a0bd938
commit ef5a0c1c3a
+12
View File
@@ -589,6 +589,7 @@ namespace Siemens_S7_Test
string byteVal = "";
ushort shortVal = 0;
uint intVal = 0;
double realVal = 0;
string byteValA = "";
string byteValB = "";
string byteValC = "";
@@ -637,6 +638,17 @@ namespace Siemens_S7_Test
contenuto += $"---------{Environment.NewLine}";
}
break;
case "real":
for (int i = 0; i < memByteRead.Length / 4; i++)
{
byteValA = Convert.ToString(memByteRead[i * 4], 2).PadLeft(8, '0');
byteValB = Convert.ToString(memByteRead[i * 4 + 1], 2).PadLeft(8, '0');
byteValC = Convert.ToString(memByteRead[i * 4 + 2], 2).PadLeft(8, '0');
byteValD = Convert.ToString(memByteRead[i * 4 + 3], 2).PadLeft(8, '0');
realVal = S7.Net.Types.Double.FromByteArray(memByteRead.Skip(4 * i).Take(4).ToArray());
contenuto += string.Format("R{0:000}: {1} | {2}-{3}-{4}-{5}{6}", i, realVal, byteValA, byteValB, byteValC, byteValD, Environment.NewLine);
}
break;
case "byte":
default:
for (int i = 0; i < memByteRead.Length; i++)