LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

state machine with analog output

Solved!
Go to solution

I have a vi designed to output an analog signal to an acuator and now I just want to add in some timing elements. My intention with the attached vi was to provide signal 1 for a certain amount of time, then switch to signal 2. I'll add a little wait time in between the two eventually.

What is going wrong here? I haven't changed the DAQ assistant or any hardware. I looked up this while loop, shift register, case structure combo on another thread. The signal graph displays the signal correctly, but no signal is coming out of the DAQ. I'm sure its something simple, I'm not the best at using labview elegantly.

Thanks

0 Kudos
Message 1 of 8
(2,989 Views)

What is your DAQ hardware? Is it capable of hardware timed AO? Did anything ever work? What error messages do you get?

 

We need more information to help you.

 

Lynn

0 Kudos
Message 2 of 8
(2,976 Views)

That is an odd way to do the state machine, but I see no issues with that part of it.

 

Is your hardware returning any error, or is it acting like it ran?  

0 Kudos
Message 3 of 8
(2,972 Views)

NI USB-6212.

The vi worked when I was manually switching the signals with a toggle seen in the attached vi. I took that vi and worked on adding in the timing.

I get no error messages.

0 Kudos
Message 4 of 8
(2,961 Views)

The false case never executes because your stop condition is when i = 2.  That happens before your timer elapses.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 5 of 8
(2,937 Views)

The loop only repeats once the timer elapses so i = 2 works fine. Plus, the signal graph shows both signals one after the other. If I remove the condition and run it continuous it will repeat the alternating pattern.

Its okay with displaying the correctly timed signals on the graph, its just not getting to the analog output. I suspect the DAQassistant is not in the right structure, I don't know where it belongs. I double checked the device and channel its suppose to be outputting to. The same device name and channel works in the alternate VI I posted. There is some syntax (if thats the right word) problem going on.

0 Kudos
Message 6 of 8
(2,911 Views)
Solution
Accepted by topic author standardms

I'm not even sure you need any of the timing VIs in there.  You are generating 1 second worth of data and then telling the DAQ to output that data.  That takes a second to do.  Therefore, the DAQ Assistant is taking up your second of time.  Therefore, you just need to toggle your boolean.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 8
(2,894 Views)

This worked. Simple and made sense.

Now I just need to tweak it to control the duration/wait

Thanks!

0 Kudos
Message 8 of 8
(2,836 Views)