Digital Multimeters (DMMs) and Precision DC Sources

cancel
Showing results for 
Search instead for 
Did you mean: 

invalid value for parameter or property

I'm trying to use an NI DC power supply in my CVI program. Since i changed the sw to use threads, i get the above error msg when trying to set the output level.

 

niDCPower_ConfigureVoltageLevel (Param->PS_hdl, Param->PS_Ch, 14)

 

When i did not use threads it all worked just fine.

What am i doing wrong? I'm quite a newbie...

0 Kudos
Message 1 of 3
(7,133 Views)

The NI-DCPower driver is threadsafe so the fact that you are using threading shouldn't implicitly cause you trouble.  I have some suggestions on debugging your problem:

 

1.  Put a breakpoint on the offending line of code and put a watch on the "Param" variable.  Make sure that it's populated.  If the data is getting populated from a different thread it's possible that that variable is uninitialized or has stale data at the point that you are calling the function.

2.  If #1 makes the problem go away, it's almost certainly an issue with an ordering dependency between your threads.  Look at your code to see if you can find and eliminate the dependency OR enforce ordering using semaphores.

 

There can be other problems but the most common things are that you have an ordering dependency between the two threads that you are not accounting for.  Look at your assumptions and make sure that they are safe.


Mzoltan wrote:

I'm trying to use an NI DC power supply in my CVI program. Since i changed the sw to use threads, i get the above error msg when trying to set the output level.

 

niDCPower_ConfigureVoltageLevel (Param->PS_hdl, Param->PS_Ch, 14)

 

When i did not use threads it all worked just fine.

What am i doing wrong? I'm quite a newbie...


 

0 Kudos
Message 2 of 3
(7,131 Views)

Hello,

 

You could also launch NI Spy to see exactly the order in which you call the NI-DCPower functions and what values you are passing in.

Start Menu -> Programs -> National Instruments -> NI Spy

 

Good luck!

Marcos

Marcos Kirsch
Chief Software Engineer
NI Driver Software
0 Kudos
Message 3 of 3
(7,125 Views)