04-01-2023 04:04 AM
I need to generate a PWM signal with a cRIO-9053 using the FPGA module. For this I need an accuracy in microseconds. I use the FPGA wait function but I found in the help that Windows only supports milliseconds, not microseconds or ticks, and that it rounds to the nearest millisecond. Is there a way to still achieve microsecond accuracy on a Windows or do I need to use a Linux computer?
Thanks in advance for the help!
04-01-2023 08:01 AM
Microsecond is impossible on Windows or Linux, only on an FPGA with known high clock rate you can achieve micro seconds.
You can use the counters on cRIO to generate PWM, why toggle the lines manually?
04-01-2023 08:40 AM
You have FPGA, so program it to run on that. Why does windows even matter? Can you explain in more details what you are trying to do?
Define "accuracy". What's the PWM frequency? How quickly does the PW need to change? etc.
04-03-2023 03:05 AM
I need to generate a PWM in order to control a X30-12-120 servo motor with a frequency of 333 Hz.
I have made this code and when i tested it on the oscilloscope it works, but the on and off times are rounded to the nearest millisecond and i need for example 1,5 ms on time to get to the center position.
When clicking on the help button of the wait time function, it says: "The Windows operating system supports only millisecond resolution. If you select a µSec or Tick resolution under Windows, the VI does not provide exact timing and instead provides an approximation that averages to the requested time over the course of the timing interval. Windows does not support resolutions under one millisecond and rounds them up to one millisecond."
My question is now how do I get resolution under a millisecond?
Thanks in advance!
04-03-2023 03:20 AM
Yes, that Wait function can be called also in Windows but in that case it will work only on ms. I'm assuming your code snippet was done for FPGA so double click on the Wait function and configure it for us. Also, since the calculated us value will always be an integer, change the representation from SGL to something more appropriate! And it would be nice to clean up your code a little, for example this looks really bad:
04-03-2023 06:27 AM
@LucianM wrote:
Also, since the calculated us value will always be an integer, change the representation from SGL to something more appropriate!
Orange wire should generally be avoided on FPGA anyways. In this case, I would let the host do the calculations and pass down the "On Time" and "Off Time" as U32 integers.
04-03-2023 07:40 AM
Hi BrittClaus,
Here's a LabVIEW FPGA example code for controlling a RC servo motor. It's been done before.
https://forums.ni.com/t5/Example-Code/Servo-motor-RC-control-using-LabVIEW/ta-p/3535211
Also, check out this video:
https://www.youtube.com/watch?v=i9aXqFvRcLw
BR
John
Add motion to LabVIEW in 30min or less - TENET EMotion
Finding it hard to source NI hardware? Try NI Trading Post