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.
02-01-2018 05:01 AM
Hi ,
I am new to FPGA programming and I am trying to learn to control the speed of the motor through FPGA. Our colleagues gave me a (plain) sample code but there seems to some problem with the loop delay. It is like, there is no effect of the loop tick count at all.
I am attaching the snapshop. I don't know what's going on here.
For the 2000000 ticks, I expect to get 5ms delay.
Solved! Go to Solution.
02-01-2018 05:05 AM - edited 02-01-2018 05:07 AM
It should be (will be) 50 ms (at 40 MHz) for 2000000 ticks. Your code uses 200000 ticks, giving 200000X25ns (or 200000/40M) = 5 ms.
Why don't you click the wait function, and change the unit from ticks to ms?
02-01-2018 05:14 AM
Hi wiebe,
I did try to change it to ms. But it was not working. I was trying to control the loop delay with my main vi using the control. No matter what values I tried the loop executing time was always the same. So i tried hardcoded value- no change in the total executing time.
Regards.
S
02-01-2018 05:19 AM - edited 02-01-2018 05:20 AM
add a 0 to 200000, so it becomes 2000000... Try that first, then we'll go from there.
02-01-2018 05:22 AM - edited 02-01-2018 05:23 AM
wiebe,
whether the value is 200000 or 20000000 or 4000000, the loop execution time is always the same. I mean there is no effect of the loop delay at all. I am not getting any warning or anyhing while compiling.
02-01-2018 05:24 AM
Could you replace the metronome to a normal wait?
02-01-2018 05:27 AM - edited 02-01-2018 05:29 AM
I only have this for FPGA. I tried with other delay - no change in the behaviour.
02-01-2018 05:32 AM
How do you measure the loop timing?
02-01-2018 05:38 AM
I'd use the normal wait, although the wait for multiple should work.
Good question: how do you measure?
Running the FPGA VI from a main VI on the host introduces room for error. Maybe the host VI links to an old bitfile or an old VI? In stead of running from a main VI, try running the VI directly on the FPGA. Then manually set the values from the FPGA VI while it's running.
Put "i" on the from panel so you can watch it (either from the panel or from the host). That would be the clearest indication of the loop speed.
02-01-2018 05:39 AM - edited 02-01-2018 05:43 AM
Hi dkfire,
The top level vi is something like this. I have an array of samples that need to be output for 65 seconds . The FPGA FGV gets sample rate input and calculate the ticks and that would be my loop delay in FPGA. So, when I finish executing the loop, I expect a value around 65000 in the looptime indicator. Now, all I get is around 27114 all the time , no matter what tick value I set.