День добрый, уважаемые
Столкнулся с проблеммой, не могу прочитать данные типа float по протоколу Овен с прибора MB110.
Код:
string nm = "Read";
IntPtr name = Marshal.StringToCoTaskMemAnsi(nm);
int i = 0;
float value = 0;
int time = 0;
ConnectionError res = (ConnectionError)NativeMethods.ReadIEEE32(
deviceAddress + i, 0, name, ref value, ref time, -1);
if (res == ConnectionError.Ok)
{
textBoxMemo.Text = value.ToString();
}
else
{
MessageBox.Show("Ошибка чтения " + nm + " : " + res.ToString());
}
Marshal.FreeCoTaskMem(name);
ошибка - NErr, код 104
обращение к dll
Код:
[DllImportAttribute("owen_io.dll", CharSet = CharSet.Unicode, EntryPoint = "ReadIEEE32", CallingConvention = CallingConvention.StdCall)]
public static extern int ReadIEEE32(int adr, int adr_type, System.IntPtr command, ref float value, ref int time, int index);
чтение через ReadUInt проходит успешно, работаю через АС4