02-14-2018 03:06 PM
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.
Solved! Go to Solution.
02-15-2018
04:48 PM
- last edited on
01-06-2025
02:16 PM
by
Content Cleaner
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
02-16-2018 01:40 AM
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… ;))
02-16-2018 11:58 AM
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.
02-16-2018
12:01 PM
- last edited on
01-06-2025
02:17 PM
by
Content Cleaner
@jdel12Would 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.
02-16-2018 01:44 PM
@GerdWClearing 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.