From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital outputs from 6008 daq to control relays

Solved!
Go to solution

Hi all, I am looking for help in creating a VI to send digital outputs from a 6008 daq to control relays. What I am trying to do is when start is pressed and a condition is met send a digital ouput to control a relay and hold for 30 secs or so to take a voltage reading which will be taken in as an analog voltage.After 30 seconds I want the first relay to switch off and the next relay to come on for the same amount of time. I want to continue this sequence for 7 readings measuring the voltage for each stage and send the data to an excel file. I know this is basic stuff but my experience with labview is limited! Any help would be greatly appreciated.

 

Thanks,

 

Paul

0 Kudos
Message 1 of 5
(3,392 Views)

Look up "state machines".

 

Basic states would be

 

Initialize,

wait,

energize/deenergize a relay

close out

 

0 Kudos
Message 2 of 5
(3,380 Views)
Solution
Accepted by topic author Pferry74

Hi Paul,

 

I have been looking into your problem this afternoon and I agree completely with Ravens Fan that the state machine is in fact that most appropriate architecture for such a DAQ task. A state machine architecture is one of the most commonly used design patterns in LabVIEW and is particularly suitable for any program where you have clearly defined stages which can be represented by states and some rules for transitioning between these states.

 

There is a Standard State Machine template contained within LabVIEW which should give you an idea of the underlying architecture and is a good place to start. To give you a better idea of how this architecture can be applied to a DAQ task, I would recommend you look at this example. Although the states will be slightly different in your case, this should provide you with a good understanding of how you can architect such an application.

 

I hope this helps.

 

Best Regards,

 

Christian Hartshorne

Applications Engineer

National Instruments UK

0 Kudos
Message 3 of 5
(3,356 Views)

Hi guys, thanks for your quick response. I will look into your suggestions and see how I get on.I clicked the soluton accepted by mistake. Correct me if i'm wrong but I can add states to control each of my relays similar to the example you posted?

 

Thanks,

 Paul

0 Kudos
Message 4 of 5
(3,337 Views)

Hi Paul,

 

Im glad I could be of assistance. There are many different ways in which you could architect such a state machine. You could create an individual state to control each of the relays, it would also be feasible to have a single state to control all of your relays. You would then need to incorporate some code to dictate which relay you were going to control at any particular instance.

 

Before you dive into coding such an application, I strongly recommend that you familiarize yourself with the state machine architecture, this tutorial is a great place to start.

 

Best Regards,

 

Christian Hartshorne

Applications Engineering

National Instruments UK

0 Kudos
Message 5 of 5
(3,306 Views)