07-13-2009 06:36 PM
I am trying to figure out why I cannot get the same results from similar commands in the Old API vs. the New API in .Net.
Using the legacy driver, I send the following command:
Call NISend(0, 16, "_PCS4 FUNC CTRL 0.125 2", NLend)
The NI Spy utility records the following for what got sent:
Send(0,0x0010,"_PCS4 FUNC CTRL 0.125 2",23 (0x17), NLend (0x01))
The legacy driver correctly sends the data and the device (a Mensor PCS-400) correctly sets the Pressure to 0.125 InHG.
If I set up the .Net program to do what should be the same thing I get the following:
MyDevice.NIDevice = New Device(0, 16)
MyDevice.NIDevice.IOTimeout = TimeoutValue.T3s
MyDevice.NIDevice.SetEndOnWrite = True
MyDevice.NIDevice.Write("_PCS4 FUNC CTRL 0.125 2")
The NISpy utility reports the following commands:
ibdev(0, 16, 0 (0x0), T10s (13), 1, 0x0000)
ibask(UD0, IbaTMO (0x0003), T10s (13))
ThreadIbcntl()
ibconfig(UD0, IbcPAD (0x0001), 16 (0x010))
ThreadIbcntl()
ibconfig(UD0, IbcSAD (0x0002), 0 (0x0))
ThreadIbcntl()
ibconfig(UD0, IbcTMO (0x0003), T10s (13))
ThreadIbcntl()
ibask(UD0, IbaTMO (0x0003), T10s (13))
ThreadIbcntl()
ibconfig(UD0, IbcEOT (0x0004), 1 (0x1))
ThreadIbcntl()
ibconfig(UD0, IbcEOSwrt (0x000D), 0 (0x0))
ThreadIbcntl()
ibconfig(UD0, IbcTMO (0x0003), T3s (12))
ThreadIbcntl()
ibask(UD0, IbaTMO (0x0003), T3s (12))
ThreadIbcntl()
ibconfig(UD0, IbcEOT (0x0004), 1 (0x1))
ThreadIbcntl()
ibwrt(UD0, "_PCS4 FUNC CTRL 0.125 2", 23 (0x17))
ThreadIbcntl()
ibconfig(UD0, IbcEOT (0x0004), 1 (0x1))
ThreadIbcntl()
The .Net driver sends the data and the device (a Mensor PCS-400) correctly sets the Pressure to 0.125 but not the Units to InHG.
What's the difference between the two drivers? How can I get the .Net drivers to send the correct information?
Solved! Go to Solution.
07-14-2009 06:04 PM
Hi Tim,
Is there a command for your device to explicitly set the unit? Do you still have the manual? Also, what legacy version of the driver are you using? If you would post more of the spy capture for the first “working” command that would be helpful as well.
Regards,
Matt
07-14-2009 06:25 PM
Matt,
Not sure what you mean by "explicitly set", but here's the complete NISpy for the legacy drivers:
RegisterGpibGlobalsForThread(0x04314920, 0x04314924, 0x04314928, 0x0431491C)
SendIFC(0)
ibfind(GPIB0)
ibrse(0,1)
ibconfig(0, IbHSCableLength (0x001F), 4 (0x4))
Send(0,0x0010,"_PCS4 FUNC CTRL 0.125 2",23 (0x17), NLend (0x01))
As for the Driver, I guess I really mean VB6 DLLs. From the "Measurement & Automation Explorer" it only lists v2.52 for the NI-488.2...
The VB6 code has been working with this device for 10 years or more. I do have the manual still.
07-15-2009 03:34 PM
Hi Tim,
It looks like in your original code you have the NLend function set to append “\n” to the end of you string but do not have the configuration in the new code. Please add “\n” to the end of your write string and let me know how it goes.
Regards,
Matt
07-16-2009 05:37 PM
Mike,
That worked. I had assumed that the following command:
MyDevice.NIDevice.SetEndOnWrite = True
was doing the same thing as the NLEnd command in the old software.
I assume then that there is no similar command and that for those devices that require '\n', you must add it to the command you are sending...