PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I wait for PXI relay settling time on a per relay basis not on a device wide basis?

I have a PXI 2569 100 relay module and a PXI 2575 mux module.  I am programming in C# and .NET.  We will have a highly parallel system with many short tests are running at the same time, each making requests to the relay modules at unpredictable times.  I would like each of my tests to be able to do something like the following:
 
   //send my relays
   //request a mux channel
   //do other work unrelated to NI gizmos
   //wait for my relays to settle
   //wait for my mux channel to settle
   //measure
 
  It seems straightforward to open or close a relay and I can see that I can choose to wait for settling time right at that moment or choose not to.  From reading the help however, it seems like all information in the help about relay settling time is on a device wide basis.  But I don't need to wait for EVERY relay in the PXI 2569 chassis to settle, I only need to wait for the one or two realys related to my one eensey test to be settled.  If I must wait for EVERY relay to be settled, then this will slow me down enormously because other tests will be making requests all the time.
 
Can I for example say:
CloseRelay 83 and dont wait for settling
//do my other work and come back later and say
CloseRelay 83 ad wait this time
 
If a long time has passed between the first CloseRelay and the second one, will the second one return immediately or will the settling time clock restart?  What happens if some other test running in another thread tells some other relay to close just before my second call?  Will the settling time restart with that other call?
 
Thank you,
Dave
 
0 Kudos
Message 1 of 8
(3,778 Views)
Dave,
 
Thank you for posting to the National Instruments Discussion Forums.
 
I would recommend you use a scan list to control your relays. A scan list can be easily created to control when relays are closed or opened and whether you want to wait for the switch to debounce or not. If you refer to the NI-Switch help under Scan Lists you can find information about how you can setup NI-Switch for scan lists.
 
Hope this helps!
 
 
Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 2 of 8
(3,760 Views)

Thanks Abhinav T.,

Scan lists seem to imply that there is some co-ordination of activity among a list of relays.  I won't have that at all.  You see, I have hundreds of tests running in separate threads, starting and stopping at unpredictable times.  Most of those individual threads only care about a single relay.  None of the threads care or even know anything at all about what is happening outside of their tiny little world with just one relay.

So, I need to close just one of 200 relays, any one of them, at any time, without any regard whatsoever to what the other 199 relays are doing.  In fact, I expect that many of those other 199 will be opening and closing as their teeny-tiny tests dictate even while I depend on my one little relay to be long since settled.

With that in mind, does it help somehow to have 200 scan lists, each with just one relay in each?

If not, then how can I know that my one little relay is settled even if others in the module are openning and closing all the time?

Thanks,

Dave

0 Kudos
Message 3 of 8
(3,754 Views)
Hi Dave,
 
I apologize for not completely understanding your problem. If you are programming with NI Switch you can use the niSwitch_Connect function to connect any route. After you call this you can call niSwitch_WaitForDebouce to wait for all connected routes to settle. You can also set a maximun time for the switch wait for the routes to settle before it returns an error. This allows you to ensure that the WaitForDebounce function does not wait forever.
 
Alternatively you could also use the niSwitch_IsDebounced function to constantly check and see if the connected routes have setteled or not. This is a non-blocking function and will allow you to process other functions while you are waiting for the route to settle.
 
You can refer to all these function in the NI Switch Help file under Programming with NI-SWITCH >> CVI/C/VB Reference >> Functions >> Route Functions
 
Please let me know if this helps.
 
 
Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 4 of 8
(3,745 Views)

So.... niSwitch_WaitForDebouce waits for *ALL* relays in the module to settle.  Is that right?  If so, then it is no good for me.

Does niSwitch_IsDebounced work on just an individual relay?  For example, can I ask if relay 87 is debounced?  And if relay 87 is debounced but dozens of other relays are bouncing like mad, will asking about 87 tell me only about relay 87 and return right away indicating that relay 87 is not bouncing irrespective of what other relays may or may not be doing?  Remember, I want to do this on a relay by relay basis and not on a device wide basis.

This has been difficult to communicate, alas.

thanks,

d

0 Kudos
Message 5 of 8
(3,743 Views)
The WaitForDebounce function waits for all paths created in that session to settle. So it all depends on the ViSession and what connections you make in that VI Session.
 
 
Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 6 of 8
(3,720 Views)

Now I need to know what the #@$% a ViSession is.  I just want to turn relays on and off, individually, and know when they are settled individually. 

 

I'd like someone to call.  After almost 2 weeks I am almost more confused than when I began 937-671-4346.

Dave

0 Kudos
Message 7 of 8
(3,716 Views)

Dave,

The ViSession is one of the inputs to the WaitForDebounce function. It is essentially a reference to an niSwitch session that is created using the niSwitch Initialize function. Any calls to a switch using the niSwitch driver require a ViSession.

I have found an example that does exactly what you are looking for as well. If you navigate to Start >> Programs >> National Instruments >> NI-Switch >> Examples >> C >> niSwitchMakingConnectionsOnASwitch >> niSwitchMakingConnectionsOnASwitch.C you can find an example that shows you how to setup a ViSession, connect a switch and wait for debounce. I have also attached the code to this post for your convinience.

You can contact an Applications Engineer by going to www.ni.com/ask

 

Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
0 Kudos
Message 8 of 8
(3,704 Views)