求C# 操控CH375的代码,求大神指点
网上的
[DllImport("CH375DLL.DLL", EntryPoint = "CH375ReadData", ExactSpelling = false, SetLastError = true)]
static extern bool CH375ReadData(
Int16 iIndex, [MarshalAs(UnmanagedType.LPArray)] byte[] oBuffer, [MarshalAs(UnmanagedType.LPArray)] Int32[] ioLength);//读单片机缓存
//写入数据
[DllImport("CH375DLL.DLL", EntryPoint = "CH375WriteData", ExactSpelling = false, SetLastError = true)]
static extern bool CH375WriteData(
Int16 iIndex, [MarshalAs(UnmanagedType.LPArray)] byte[] iBuffer, [MarshalAs(UnmanagedType.LPArray)] Int32[] ioLength); //写单片机缓存
public static bool ReadData(int index, byte[] buffer, ref int length)
{
ReadLength[0] = length;
bool r = CH375ReadData(0, buffer, ReadLength);
length = ReadLength[0];
return r;
}
//写入数据
public static bool WriteData(int index, byte[] buffer, ref int length)
{
ReadLength[0] = length;
bool r = CH375WriteData(0, buffer, ReadLength);
length = ReadLength[0];
return r;
}
那里面的读写 都SlaveDecAddr 和 Startadd 那怎么知道从哪个寄存器的位置开始的呢?
如果我要读写制定的寄存器位置,该如何写呢?