LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Signal Degrades Overtime

Hello, I am writing a vi for a usb mouse interface to measure velocity when the mouse is moved. It seems to work, however after a certain period of time the signal degrades into complete noise or seemingly so. I have attachted my code here, I am wondering if anyone can reproduce the problem, and what could be possible solutions to the degradation, I know it is a real problem code wise since I have tired to isolate as many possible external influces as possible.

 

Let me know if additional information is needed.

0 Kudos
Message 1 of 8
(2,650 Views)

I cannot test your VI because I do not have suitable hardware.

 

Since the Analog Read VI is outside the loop and it reads one point, your conversion to an array and then integrating one point does not make any sense.

 

Next you are mixing many different numeric representations: U8, I8, I32, U32 and DBL.  Maybe it is OK, but there may be opportunity to make conversion errors.

 

You are building arrays inside the while loop.  This can cause memory allocation problems and can result in crashes or slowing of the program.

 

You close the VISA session in the Record Movement case inside the loop.  Does your interrupt work correctly after that?  You have the error cluster wired, but you do not check that error.  You may be processing default data out of the Error case after the first loop.

 

Lynn

0 Kudos
Message 2 of 8
(2,626 Views)

I have fixed some of your suggestions however it had no effect on the degradation of the signal. Since I have yet to find a work around, I am merely outputting a saved recording of the signal without going through DAQmx. It seems to work well without the output, which to me seems like a hardware (wires, card, shielding) problem. I have tested all incoming signals and changed cards (6221) and the bncs with no effect. So it seems to be a code problem, and since it starts out fine each time the program runs, I believe it must be something involving the data acquisition via DAQmx and time loops .

Nonetheless I have one last problem, which I believe is trivial yet beyond my intuitive understanding that being how to control a time loop with an external trigger. In other words I want to program to be running always but only start the loop if and only if PFI0 is set to an edge.

It seems to me that there is no direct way of doing this, I have found within DAQmx a digital counter with an edge, but I do not need a counter, only a trigger to start/stop the loop.

 

Thank you for your time,

DB.

0 Kudos
Message 3 of 8
(2,601 Views)

 


I have one last problem, which I believe is trivial yet beyond my intuitive understanding that being how to control a time loop with an external trigger. In other words I want to program to be running always but only start the loop if and only if PFI0 is set to an edge.

It seems to me that there is no direct way of doing this, I have found within DAQmx a digital counter with an edge, but I do not need a counter, only a trigger to start/stop the loop.


 

 

That sounds like a great application for a state machine architecture using the level of your digital line (no counter necessary) as the case selector to determine each subsequent state.

 

Hope this helps!

 

- Greg J

0 Kudos
Message 4 of 8
(2,580 Views)

What specific I/O do I use for a trigger (a DAQmx one)? How can this be set up? 

 

I will look into state machines for now, although I am not familiar with the process seems simple enough though.

 

Thanks for the suggestion.

0 Kudos
Message 5 of 8
(2,571 Views)

Are you trying to use the state of your PFI line to trigger another DAQmx acquisition, or are you just wanting to execute various code depending on the state of the digital line.

 

- Greg J

0 Kudos
Message 6 of 8
(2,553 Views)

I merely want to execute the timeloop iterations when the digital line (trigger) edge is detected, without the need of additional DAQmx outputs...

 

-DB

0 Kudos
Message 7 of 8
(2,535 Views)

Hi DB,

 

Check out this forum... it seems to have an example that may be what you're looking for.

 

- Greg J

0 Kudos
Message 8 of 8
(2,508 Views)