LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Filter signal problem

Sinus?  As in a nasal cavity?  Or sine wave.

Smiley Happy Sorry, of course sin wave.

 

I've tried with queue and local vars (here is local-var version).

Didn't help.

Also changed wait in upper loop to 2ms (if I properly understood your suggestion) ... it became even worth: step length about 50ms.

Finally I chenged wait to timer (more rigorous time control).

Still the same rpoblem.

 

staircase_sin_steplength_issue.png

0 Kudos
Message 21 of 24
(975 Views)

What are you trying to do with the upper loop?

 

Did you put in some tick count values to see how fast your upper loop is actually running?

 

It sounds to me like you are trying to make it run at 1 millisecond.

But the problem is the other code in that loop is taking longer than a millisecond.

The loop can't run any faster than what the slowest code in it will allow.

 

(I now see you are using the "metronome" wait function.  The wait until next msec function.  It probably doesn't matter for a 1 msec wait.  But that function is the wrong one to use nearly 99% of the time.  (When I took LabVIEW basic, either the book or the instructor was teaching to use that one)  The correct one is the regular wait.  The metronome synchronizes the wait to the system clock.  So if you have a 100 msec wait and your code consistently takes less than 100 msec.  The loop will iterate on the 100 msec intervals of the system clock.  If for an iteration the rest of your code takes 101 msec or more, the loop won't iterate again until the 200 msec mark.

 

See how long that loop takes to run.  If it takes longer than 1 msec, you need to figure out how to make it run faster, or forget about trying to run that at 1 msec.

Message 22 of 24
(969 Views)

Ok, clear, will try to measure ...

0 Kudos
Message 23 of 24
(960 Views)

Yes, you had a reason - the time of execution of one iteration is much higher than 1ms. According to my measurements it varies between 2.5 and 3ms.

It explains that spectrum lines (that correspond to harmonics of staircase steps) are quite spread.

 

loop_iteration_time_BD.JPG

 

loop_iteration_time_FP.JPG

 

0 Kudos
Message 24 of 24
(936 Views)