LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed digital output - DAQ Assistant

Solved!
Go to solution

Apologies for asking such a simple question, unbelievably I wasn't able to find my question when searching, so maybe I wasn't using the correct keywords.

 

I have a very simple application with a USB-6211. I'm using two digital outputs (PFI4 OUT, PFI5 OUT) and want to do the following task.

 

1) turn PFI4 on (high), thus creating a voltage and turning my device attached to that pin on.

2) wait one to two seconds.

3) turn PF15 on (same as PFI4).

4) wait six seconds (both outputs still on/high).

5) turn PFI4 off (low), thus turning my device off.

6) wait one to two seconds.

7) turn PFI5 off (low).

😎 wait six seconds (both outputs off/low).

9) repeat back to step 1).

 

Now, I'm completely new to LabVIEW and have been trying to achieve this task all day! I've put down a DAQ Assistant, which when toggeling the radio button when setting it up worked fine, turned my device on and off as planned. But now trying to add something to the data line I'm having all sorts of trouble with getting a boolean input and making it a 1D array. As you'll see from the attachment I've got my DAQ Assistant within a while loop and have got a three second timer inside as well, just experimenting at the moment.

 

If someone can tell me how I can attach a boolean input to my DAQ Assistant with a timer that switches between true and false every X amount of seconds I will be very grateful!

 

Once again, sorry for the simplicity of the question, I really did try searching the forum first! 😞

 

Cheers,

Ritchie

0 Kudos
Message 1 of 16
(4,776 Views)

Hello,

 

The most simple way I can think of to do this task is using a simple state machine, with one state for each of your steps. If you aren't familiar with state machines you can find a lot of examples by using the example finder in labVIEW.

In each state you will have a DAQ assistant and a wait function for the required time.

 

If you need more clarification on this problem, I'm glad to help.

 

Regards,

Toader Mihai

Message 2 of 16
(4,755 Views)
Solution
Accepted by Ritchie888

Hey Guys,

 

While I was creating a piece of example code Toader Mihai reponded, and took the words straight out of my mouth.

A statemachine is the simplest, most scalable method of architecting this application.

 

FrontPanel.jpg

 

Please see the attached code (saved in LabVIEW 2010), which simulates the DIO with some front panel LEDs. Obviously, you can easily add you DAQ tasks into this example code.

 

Enjoy!

Rich Roberts
Senior Marketing Engineer, National Instruments
Connect on LinkedIn: https://www.linkedin.com/in/richard-roberts-4176a27b/
Message 3 of 16
(4,747 Views)

Hi Toader,

 

Many thanks for your response!

 

I did a search through the NI examples and only found one example of state machines (State Machine Test Sequencer) and it didn't seem particularly helpful. I have done state machines in the past, however, just not in LabVIEW!

 

Any specific example you can recommend to get me started?

 

Cheers,

Ritchie

0 Kudos
Message 4 of 16
(4,744 Views)

Ah! And while I was replying, RER also replied! 😛

 

Thank you VERY much for the code. I'll test it out shortly and let you know how I get on.

 

Many thanks to both of you.

 

Cheers,

Ritchie

Message 5 of 16
(4,743 Views)

You guys are absolute legends! The code you posted, RER, worked a treat! I added DAQ Assistants on the PFI4/5 outputs, and added controls to the timings so that I can control the on/off times by changing a number on the front panel (I also added a system which turns both devices off once the program is stopped, as they could have been left on depending on when you stopped the program).

 

Works brilliantly!

 

Many thanks once more! 😄

0 Kudos
Message 6 of 16
(4,735 Views)

Hi Friends

 

I found this post that is near that I wanted.

 

I have a 4 relay to be armed by 4 digital outputs

 

1- i need to save data each secound (temp sensor)

2- At 0 time i need to arm four relays, 1 of them during next 3 mints, the others next 6 hours. After that tunr of the relays, one of them for 3 mints, the others 6 hours

3- A control to choose the number of this cycles.

 

Best regards

Carlos 

0 Kudos
Message 7 of 16
(4,358 Views)

Hi Carlos,

 

Thanks for posting. How have you approached developing this project? I see that you're aware of the requirements of your project but the community as a whole will be better suited to advising you if we knew more about what you've attempted thus far and the challenges you were facing. 


ShalimarA | CLA
0 Kudos
Message 8 of 16
(4,328 Views)

Hi Shalimar

 

 

Here is my last developments. Improvements are well come.

Today I will buy a relay module to connect in my ni6008 and then connect to the machine.

 

 

 

 

Best

Carlos

0 Kudos
Message 9 of 16
(4,325 Views)

Hi Carlos,

 

I recommend that you take a look at the following. In terms of logging your data, please navigate to:

NI Example Finder -> Fundamentals -> File I/O and take a look at the writing to file examples, particularly TDMS - Write Data(triggered).vi

 

I also recommend looking at the examples on Digital Input and Digital Ouput (Example Finder -> Hardware Input and Output -> DAQmx -> Digital Output). I understand that you don't currently have hardware but at the moment there is nothing present in your code to actually imply that you intend to communicate with hardware. I recommend installing the DAQmx drivers that you need to use to run the USB 6008 and begin developing your code so that it can communicate with your hardware. You can get these drivers here

 

Finally, there are many other forum posts available on controlling relays that I've found. I recommend taking a look at what has been done previously. One example is here


ShalimarA | CLA
0 Kudos
Message 10 of 16
(4,321 Views)