LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous Analog Read/Write

Solved!
Go to solution

Good morning,

 

I'm attempting to create a simple signal genorator that will send an analog command signal to a device and then read the devices position feedback.  (Check out the attached VI)

 

The program must accept the users input for DAQ Max and DAQ Min Voltage, and I/O Analog channel selection becuase any daq from 6008 to 6215 will be used.

I think the best way to set this up is with virtual DAQ channels.  I found another example on the forum, but it didn't work for my setup.

 

 

I'll be very grateful with any suggestions you have!

 

Thanks,
Christopher

 

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

DO NOT DO THAT!

 

When posting attached code please use default settings for the windows execution options.  attaching a file set to run when opened and a race condition involving a missused local variable that forces an infiate loop is just rude. (And potentially unsafe)

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 11
(3,547 Views)

Sorry about that.  I wasn't thinking. 

 

The VI is attached.

-Christopher

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

OK that is a nice looking UI but you have some fatal flaws in the vi.  (Don't try to find the "settings" control from the terminal you will crash LabVIEW)

 

Your code definately suffers from an overuse of local variables. 

Place the terminals for latching booleans inside the event that handles them.

Look at using a queued message handeler to drive the state of the lower (consumer) loop

(Why is there logic "If listbox is 0 or 1" infront of the case selector? wire "Listbox" directly to the selector and cases 0,default and 2 would do the same thing

 

Do not create a DAQmx task every time you use it.  DAQmx tasks need to be created only once Preferably during development and not at run time if it can be avoided.  (Save them in the project and your deployment can import them onto the target)

 

Consider using an Action engine to encapsulate the DAQmx functions (Init Task, Config, Run, Stop, and Close Task states seem about right) 


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 11
(3,537 Views)

You also left no way to stop the program.  You should exit the program with the Exit button on Value Change.


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
0 Kudos
Message 5 of 11
(3,534 Views)

It looks like you want to create a waveform, but you're DAQmx Write is set for 1 channel 1 sample.  Yet you are sending an array to it would only make sense for N channels/1 sample, or 1 channel/N samples.

0 Kudos
Message 6 of 11
(3,531 Views)

Jeff,


Thanks for the reply!  What do you mean by 'findkng the settings control from teh terminal'?

 

I'll look over the recomended changes.  Will adding an action engine around the DAQmx functions allow simultanious analog read/write?  That is what I'm struggling to create successfully.

 

 

Thanks,

Christopher

0 Kudos
Message 7 of 11
(3,528 Views)
Solution
Accepted by topic author Pickering

Found a solution!

 

Thanks everyone.

-Christopher

0 Kudos
Message 8 of 11
(3,515 Views)

Don't just say you found a solution, then go and mark your own post as the solution.

 

Did someone's post help lead you to the solution?  In that case, mark their message as the solution.

 

If it turned out to be something else, then please put some detail in your message as to what your solution was.  That way if anyone in the future is searching for the same problem and finds your message thread, then your newfound knowledge would be able to help them.

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

It turns out that my error was in the method I was using to plot the data. Origionally I was trying to plot the output signal and feedback signals on the same plot.  Becuase of the different data types it wasn't working.  Now I've forced it to work by using two different types of plots and making one transparent. 


Check out the attached vi.

-Christopher

0 Kudos
Message 10 of 11
(3,503 Views)