Files
s7netplus/S7.Net/Types/Bit.cs
Thomas Ze 7cedec5909 - fix data type converting
- add new string string data type
2018-03-18 21:26:22 +01:00

29 lines
684 B
C#

using System;
using System.Collections;
namespace S7.Net.Types
{
/// <summary>
/// Contains the conversion methods to convert Bit from S7 plc to C#.
/// </summary>
public static class Bit
{
/// <summary>
/// Converts a Bit to bool
/// </summary>
public static bool FromByte(byte v, byte bitAdr)
{
return (((int)v & (1 << bitAdr)) != 0);
}
/// <summary>
/// Converts an array of bytes to a BitArray
/// </summary>
public static BitArray ToBitArray(byte[] bytes)
{
BitArray bitArr = new BitArray(bytes);
return bitArr;
}
}
}