LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Microseconds wait time on Windows?

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!

0 Kudos
Message 1 of 7
(2,700 Views)

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?

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 7
(2,674 Views)

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.

0 Kudos
Message 3 of 7
(2,665 Views)

I need to generate a PWM in order to control a X30-12-120 servo motor with a frequency of 333 Hz. 

BrittClaus_1-1680508574784.png

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.

 

BrittClaus_0-1680508511235.png

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."

BrittClaus_2-1680509021623.png

 

My question is now how do I get resolution under a millisecond?

 

Thanks in advance!

0 Kudos
Message 4 of 7
(2,591 Views)

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:

LucianM_0-1680509957886.png

 

Lucian
CLA
0 Kudos
Message 5 of 7
(2,587 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(2,562 Views)

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

Message 7 of 7
(2,545 Views)