05-23-2024 06:56 PM
Hi experts!
I am having some issues with my Labview code (I am new to coding the software, and my lab has an older version). My goals is to find the time difference between 2 signals coming in, and display a light (green or red) if this time is within a certain range. I want it to continue doing this for each pair of signals that comes through, as my participants will be completing a task where they're moving between 2 targets for a set of 100 or so and I want them to know if they're moving fast enough each time. I've set up my DAQ assistant and tested the code with artificial inputs and the code shows no errors and the input is successfully graphed. However, there is no change in the light colour, and no display of the time difference. I'm wondering if anyone has some ideas as to what I'm doing wrong and what I can do to fix this.
I have tried to used case structures to identify when the first target is left and a 5V pulse changes to 0 and when the second target is achieved and changes from 0 to 5V. If this is true, I then want the time that those events happened to be recorded, the difference found, and then have that compared to a predetermined time. Should it be beyond 10% of the predetermined time, I want a red light displayed and should it be within this, a green light displayed.
Happy to give as much detail as needed. Thankyou so much!
05-23-2024 07:16 PM
Use DAQmx Examples instead.
Most shipping examples return data in waveform data type. The waveform datatype contains the timing information including start time and time interval. See Accuracy of the Waveform Timestamp Returned by NI-DAQmx
05-24-2024 11:59 AM - edited 05-24-2024 12:03 PM
Let's assume the signals are fine and this is a programming question.
As a first step, you need to understand the basics of dataflow, so start with the learning resources.
We can give much more specific help once you attach your VI. We cannot debug pictures because many things are hidden. For example we cannot see how the express VI is configured and how many points you get. Wiring a dynamic boolean data to a case structure probably does not do what you think it does..
05-24-2024 12:29 PM
05-24-2024 08:44 PM
Thankyou so much for your ideas and suggestions! As I said this is very new to me, so just finding my way, obviously with lots of errors at this stage.
Are you suggesting that the latter part of the code that displays whether or not the time difference satisfied the predetermined criteria and displays a light also be in the loop?
I'm working through your suggestions currently, and have attached the vi in the meantime.
Thankyou 🙂
05-24-2024 08:54 PM
Thankyou, I will try this and see how it goes
05-25-2024 10:24 AM
@cr922 wrote:
Thankyou so much for your ideas and suggestions! As I said this is very new to me, so just finding my way, obviously with lots of errors at this stage.
Are you suggesting that the latter part of the code that displays whether or not the time difference satisfied the predetermined criteria and displays a light also be in the loop?I'm working through your suggestions currently, and have attached the vi in the meantime.
Thankyou 🙂
As already discussed, the code you have attached is completely wrong, of course. I don't have DAQ installed, so I cannot see how your express VI is configured.
My earlier example assumed that you get both full traces and see both peaks. If you get the data one point at a time, you would just put the tick into a shift register whenever signal A goes high and get the time difference when B goes high. Should be equally simple to implement...