From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
03-19-2018 12:45 PM
Hello,
Thanks for replying.
For point 1, how will I be able to solve this? I've been sending a 500Hz TTL to it and it seems to activate as soon as it reads the signal.
For the second point, I just need to set up the task outside the case structure and the start within the true case of the case structure?
and sorry yes I did notice, I was trying some different things and forgot to delete the outer loop haha!
03-20-2018 03:16 AM - last edited on 01-08-2024 02:51 PM by migration-bot
For point 1) If it works in your current set-up and it is not mission-critical, then use it like it is. Otherwise a hardware trigger like discussed above would be the solution.
For point 2) I have an example on mind, but cannot find it. Maybe I have seen it in the Embedded Control and Monitoring course. This will do: 4. NI-DAQmx Trigger. The "Create a Trigger in LabVIEW" screenshot it is. After adapting it to your setup of course (e.g. from AI to DO etc.). Only the nodes from Start Task to Stop Task will be inside the loop.
04-18-2018 10:40 AM
Hi,
I've been working on the VI. This image shows my final VI. The TTL input from the Arduino is displayed on the graph. At 1Hz, the graph becomes very slow to respond but I don't know the reason for this.
I tried to use the "simulate signal" VI to output a square wave voltage from A0. On the oscilloscope, it shows that it is output the correct frequency etc but the LED doesn't seem to respond accurately. What could be the cause for this?
Thanks for your help!
04-19-2018 02:28 AM
It is very hard to help you when there is only a screenshot of the VI and not the VI itself. Please consider attaching your full project the next time instead
I noticed that inside your loop there are two things forced to happen in parallel although they are probably not meant to be: Your voltage reading task looks to be set to read infinite ("-1") samples (cannot check because it is just a png), and your PWM generator will start afterwards. Looks odd.
04-19-2018 04:18 AM
I apologise, I didn't have access to my files at the time of the reply, only a previous screenshot.
I have attached both vi's to this reply.
04-19-2018 08:05 AM
Don't worry^^
Wait, what exactly are you trying to do? I don't get it fully from your code and have the feeling there are two things mixed: You are reading the analog signal to catch a trigger, and if so, you start your PWM output part. Intentionally, the execution will wait until the PWM output is done. During this time, the Analog Wfm Read won't happen and the TTL Signal chart not updated.
I attached a slighty cleaner VI that doesn't do the Channel Creating and Task Clearing every loop iteration but only outside of it once. It'll still update your PWM setting to the UI every loop iteration. No guarantee though, I don't have any hardware here to test.
If you want to have the graph updated at a steady rate anyways but still catch all triggers, this will lead to a more complicated approach. Because then you need one loop to read the input and update the graph and one in parallel to execute the PWM out. These two loops need to talk to each other so the second loop gets notified when the first one sees triggers. Is this what you want? Depends on your application of course. Maybe you already mentioned if, but I was not sure reading through this thread again.
04-19-2018 08:19 AM
I cannot use the pause trigger property node therefore I am using a case structure to pause and start the pwm of the LED
The TTL signal arrives from the Arduino to an analogue input on the mydaq which starts or stops the case structure depending if it is true or false
I need the input from the Arduino which is shown on the graph to continuously catch a trigger and start and stop the led accordingly
04-20-2018 02:59 AM - last edited on 01-08-2024 02:51 PM by migration-bot
I'd implement this the following way:
This way you uncouple the PWM output from your input loop. Here is some information on Functional Global Variables (FGV):