LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending a pulse to output pin using a switch

Solved!
Go to solution

Hi,

 

this is my first program in labview.

 

I want to use a while loop to continuously input data to the DAQ , which displays it to an oscilloscope. The signal out should be controlled by a switch (0 when switch is open and 1 when switch is pressed).

 

I placed a toggle switch in the while loop, and connected the output to the DAQ manager, but it is showing a connection error.

Type of source is boolean.

Type of sink is 64 bit real.

 

So how should I convert data from the switch so that it gets fed into the DAQ output?

 

Thanks.

0 Kudos
Message 1 of 11
(3,416 Views)

Its tough to imagine how you might have coded can you please post the code you have made then its easy (Post in 2009 version . File>>Save for previous version>>Select 2009 and save)

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 11
(3,415 Views)

What happens to the signal when the switch is off?

Go to zero? Go to some other value? Remain at last "on" value?

0 Kudos
Message 3 of 11
(3,412 Views)

Sorry, here is my code.

 

I think I need to either convert the individual pulses to an array, or change the chart type so that it takes in data continuously.

 

 

0 Kudos
Message 4 of 11
(3,406 Views)

When switch is off, it sends a zero, when it is on, it sends a 1.

0 Kudos
Message 5 of 11
(3,405 Views)

Hi,

 

Your example code seems to need a build array function to get array of boolean. Could you check it?

 

Br,

Peter

Message 6 of 11
(3,401 Views)

By the way,

 

Do you know that, the boolean value outside of the loop will get value after pressing the stop button(once)?

If you vant to change it in every iteration, you should put it inside the loop.

 

Br,

Peter

Message 7 of 11
(3,399 Views)
Solution
Accepted by SohamSaha

@Soham_S wrote:

When switch is off, it sends a zero, when it is on, it sends a 1.


Then you have to keep DAQmx inside the while loop probably you can use event structure to do this. Also while you configure the Digital output you should select single channel instead of multiple (unless you really have multiple channels) then you will be able to wire the switch directly to it.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 8 of 11
(3,383 Views)

Here's the updated code.

 

Here, in the chart indicator, the time value keeps increasing, and I cannot see the data of the entire run at once. What can I do so that I can see all the 1s and 0s in the graph, along with the time, after the program is stopped.

 

Also, now the DAQ setting is set into 1 sample on demand. So if I export the data to a  measurement file, the array is not continuous.

If I set it to continuous samples, the connection diagram shows an error. What can I do so that I can store the data in a file, so that it can be read by the chart later?

 

I am attaching my code below.

0 Kudos
Message 9 of 11
(3,366 Views)

Please post in 2009 version.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 10 of 11
(3,362 Views)