|
|
| Author |
Message |
dle User

Joined: 10 Jan 2007
Posts: 4
|
Posted: Wed Jan 10, 2007 7:20 pm Post subject: Reading from PT-104 in C# |
|
|
I am attempting to read temperature values from a PT-104 with attached PT100 in C#. Interfacing with the driver seems to work fine up until I attempt to get the temperature values, which always fails. No error messages are given so I can't tell what is going wrong.
| Code: |
[DllImport("PT10432.DLL")]
private static extern short pt104_open_unit(ushort port);
[DllImport("PT10432.DLL")]
private static extern void pt104_close_unit(ushort port);
[DllImport("PT10432.DLL")]
private static extern short pt104_set_channel(ushort port, ushort channel, ushort dataType, ushort numWires);
[DllImport("PT10432.DLL")]
private static extern short pt104_get_value(long[] data, ushort port, ushort channel, ushort filtered);
...
long[] data = new long[256];
short result = pt104_open_unit(1); // returns 1 (true)
result = pt104_set_channel(1, 4, 1, 4); // returns 1
result = pt104_get_value(data, 1, 4, 0); // returns 0 (error!)
|
The probe works on this channel (tested using PicoScope), so I am sure its not the hardware. The only other thing that I have noticed is that the array 'data' returns with the first value equal to '1' and the remainder are left as 0.
Any help would be appreciated. Thanks.
Dave |
|
| Back to top |
|
 |
Erik PICO STAFF

Joined: 23 Oct 2006
Posts: 4
Location: Cambridgeshire, UK
|
Posted: Tue Jan 23, 2007 9:31 am Post subject: |
|
|
See the following paragraph in the documentation for the driver about the return value of pt104_get_value()
Returns:
TRUE - if a reading is available
FALSE - if any of the inputs are out of range. It will normally return FALSE for a few seconds after you open the driver, until the driver has taken a reading from the specified channel
Could this be your problem? |
|
| Back to top |
|
 |
dle User

Joined: 10 Jan 2007
Posts: 4
|
Posted: Tue Jan 23, 2007 5:41 pm Post subject: |
|
|
I am sure this is not the case, since I've tried taking readings very shortly after taking a successful reading from PicoScope (indicating that a reading is available). I've queried the device minutes after initializing the driver, which should be enough time for any "startup", yet no results.
Any other ideas would be appreciated. Thanks. |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|