LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cDAQ voltage four channel LED control - LED stays on in final repeat

Solved!
Go to solution

I have a four channel LED system where I'd like to control LED intensity and time-on for each LED separately- with specific number of iterations of this stimulus (see attached diagram).

 

We're using an A/O module on cDAQ system to control each individual LED and zero frequency sine waves to set up the LED voltages (snippets attached) - each LED also has a specific 0V pre and post stimulus time. The LEDs need to have the same timing so that each waveform executes at the same time and the stimulus needs to be repeated several times (controlled by the front panel and a loop). Ive set up a subVI which ensures all the waveforms are of equal length (MakeWavelengthEqual(SubVI)) as well as one subVI to generate a digital output for the duration of the LED on time (TrigOutGen(SubVI)) to trigger out data acquisition equipment. 

 

The VI creates these Waveforms and output them to each individual channel, whilst also repeating them. However I keep having an issue where the LED outputs don't quite correlate to the waveforms I've set up - and the final LED output repetition seems to create a situation where the LED stays on even after the VI completes its run. 

 

I'm new to labview so troubleshooting these issues is very difficult to me, I get no errors, the waveforms look correct when plotted and the task is set up to clear outside of the loop so I'm not sure where the problem with the final output occurs.  I'd really appreciate any help anyone can provide. 

0 Kudos
Message 1 of 6
(2,896 Views)

Hi Fimsy, 

 

Would you mind sharing the VI or some snippets? You can use debugging tools, like Highlight Execution to see if it gets stuck at some point in the For Loop, on Wait Until Done, or somewhere. Maybe using that you'll see what is going on with the code and why is it leaving the LED on.

 

Here's some info on debugging apps in LabVIEW: https://www.ni.com/en/support/documentation/supplemental/12/debugging-techniques-in-labview.html

 

And I don't know if this is what you did, because you talk about snippets, but they were uploaded as png images, so here's how to create snippets: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x2PkCAI&l=en-US

Message 2 of 6
(2,863 Views)

Hi Fimsy,

 

the waveforms look correct when plotted and the task is set up to clear outside of the loop so I'm not sure where the problem with the final output occurs.

Clearing the DAQmx task does NOT set the AO outputs to zero - maybe that's the problem?

 

Please attach real snippets or VIs instead of images. (And cleanup the block diagram before posting… ;))

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 6
(2,854 Views)

Thanks Gerard.

 

I usually always 'Clean up Diagram' but it seems unless I do it manually it doesn't make a big difference to the VI layout in this case? Sorry if it looks a mess. I've saved as snippets and attached here, hopefully it works, if not I can post the VIs themselves.

 

The Waveforms themselves are set up to have a period of 0v output before and after a positive voltage (Pre-Post stimulus time) - which is another confusing aspect of this problem. 

0 Kudos
Message 4 of 6
(2,846 Views)

@jdel12

Would you mind sharing the VI or some snippets? You can use debugging tools, like Highlight Execution to see if it gets stuck at some point in the For Loop, on Wait Until Done, or somewhere. Maybe using that you'll see what is going on with the code and why is it leaving the LED on.

 

And I don't know if this is what you did, because you talk about snippets, but they were uploaded as png images, so here's how to create snippets: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x2PkCAI&l=en-US


Hi jdel12 

Thanks, I have been using the debugging tools, there don't seem to be any stopping points in the for loop or wait subVis - the first few executions of the loops seem to be okay in timing and execution steps, its literally the final loop that seems off. 

 

Thanks for the suggestion on snippets, I wasn't aware they were different save options. I've attached them to a reply to Gerard. 

0 Kudos
Message 5 of 6
(2,845 Views)
Solution
Accepted by topic author Fimsy

@GerdW

Clearing the DAQmx task does NOT set the AO outputs to zero - maybe that's the problem?

 


I found the problem(s)! Stupidly the lengths of the DO waveforms and AO waveforms were different - mainly because I didn't wire up one pretty important input to my subVI because I couldn't see that I missed it - I'm going to now ensure I set them as required in future. I also made a rookie mistake with the sample numbers for each channel - I thought I needed to multiply sample numbers by number of repetitions of the loops but it turns out that I didn't. 

 

My final goals are now:

1. trying to figure out the best way to configure my DO signal timing as a trigger for another device!

2. Creating some sort of GUI where a user can specify multiple different "routines" to run automatically in a sequence (ie user runs same stimulus but increases voltage or duration for subsequent iterations of the repetitions).

 

Any suggestions/tips on how not to now break this VI whilst implementing this would be great but i'll probably end up creating a new post with problems there. 

0 Kudos
Message 6 of 6
(2,837 Views)