LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

changing NI-9485 switch

At present, using DAQ Assistant, I am able to operate the six switches needed on an NI-9485 CompactDAQ switch module.  Using a For Loop and Case Structures, it is possible to operate six external mechanical reed relays via the 9485.  Works fine, but, with each Case the DAQ Assistant will access the 9485, close the selected switch and open all others ( then a Wait delays the next Case so the external instrument signal can be measured), and then terminate access to the 9485.  In the following Case, DAQ Assistant goes through the same process.  Since the Wait is 30 sec, which is the time for the external insturment to settle, the time opening and closing access to the 9485 is not annoying.  But, the lack of VI sophistication is.

 

A minor complication:  the number of switches to be operated changes as the experiment changes.  This I accommodate by controlling the For Loop Count using the number of switches to be operated, and iterating the Cases via the For Loop iteration.

 

I tried creating a DAQmx Task in which the six 9485 switches are selected as digital outputs. But, when a DAQmx Write VI is selected, the only choices seem to be: 1.) writing the same Booliean value to all the channels in the Task, or 2.) creating a separate Task for each switch, and calling it twice (once to close the switch and once to open it again).  What I want to do is tell the 9485 to close one switch, and open all the others, in a cleaner way than using DAQ Assistant.  As stated in the first paragraph, the VI works now.  Any suggestions?

 

 

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

I forgot to mention that I tried using Property Nodes to change 9485 Switch states, but it did not seem possible to identify a unique switch using the Property node feature.  Each Case would seem to require six Property Node Vi's if using them were plausible.

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

Hi Reserved,

 

I think that it would be helpful for you to use the lower level functions rather than the DAQ Assistant so that you can more closely control what the switch is doing. I would recommend starting with the examples in LabVIEW (Help » Find Examples…) and then opening up the switching example folder (Hardware Input and Output » Modular Instruments » NI-SWITCH). The example “niSwitch Controlling an Individual Relay.vi” could be a good place to start off.

 

Regards,

 

Jason D

Applications Engineer

National Instruments

0 Kudos
Message 3 of 7
(3,753 Views)

I looked for examples, but my 2012 Basic SP1 package does not contain "Modular Instruments," under "Hardware..."  and a search of all examples revealed nothing on "niSwitch."  I can easily control a single switch using VISA resources.  Controlling all the switches simultanelously and in a sophisticated way, one on and the rest off, is the challenge.

 

I also have a copy of Labview 2011, and will see what I find there.

0 Kudos
Message 4 of 7
(3,744 Views)

Couldn't find any relevant examples in the 2011 Labview Full Development package either.  But, I think I have a solution.  In using a DAQmx Write vi, and selecting the 1-D, multiple channel, single element option, I built a Boolean array and delivered the array to the Write vi data input.  It seems to work in the "bench tests", but I won't really know until I get to the experiment next week.

 

The only problem evident is passing the Task I.D. and Errors through tunnels in the Case and For structures.  Leaving the For structure, the two are an array, but the Close Task and Clear Task expect singles rather than arrays.  More investigation needed.

0 Kudos
Message 5 of 7
(3,729 Views)

Hi Reserved,

 

I had mistakenly thought the NI-9485 was supported by the NI-SWITCH driver, but it is not. It may be helpful to post your code, but what is likely happening is that we are currently telling the DAQ assistant “close one switch”, but that is seen as “close one switch and only one switch”.

 

What you did in order to resolve the issue was to specify each state (A, B, and C relays closed and then B and C relays closed) rather than try to change a single item.

 

The For Loop has auto-indexing enabled by default, so we should disable that in order to ensure that an array is not being built. I have included an example below that shows how auto-indexing works.

 

Auto-Indexing: https://decibel.ni.com/content/docs/DOC-20828

 

Regards,

 

Jason D

Applications Engineer

National Instruments

0 Kudos
Message 6 of 7
(3,726 Views)

Thanks, Jason.

 

I added some test Booleans to my code, and it works.  The Ni-9485 will be receiving the correct signals, and the proper switches should open and close as instructed.

 

I will examine the example you sent to learn how to write it better.  Since I have established a Task with six switches selected on the 9485, Labview indicated that the same number of states must be delivered as there are channels selected =>six Boolean states must be delivered to the DAQmx Write vi in every Case.  And, the states delivered change every Case.  I look forward to trying another way with only For loops.

 

Thanks again.

0 Kudos
Message 7 of 7
(3,709 Views)