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.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

myDAQ software timed maximum rate

Hello Everyone,

 

I'm learning how to use Mydaq and the task model, I have made a program to drive an LED using PWM on the digital output 0. It works, but it has a lot of flickering. I understand that the flickering perceived by the human eye should disapear about the 200 Hz. At the moment I'm using the simulate signal module to generate an square wave, and it does not matter how fast I drive it the flickering it does not go away. The document "myDAQ_Manual.pdf" in the section "General Purpose Counter/Timer" mentions:

Internal base clocks: 100 MHz

Maximum counting and pulse generation update rate: 1 MS/s
 
This information is about the counters, does apply to the digital outputs as well?, if not what is the maximum frequency that I can drive the digital outputs using a software timed clock?
finnaly: How ugly is my code, is this the correct way of driving the digital outputs?
 
Thanks in advance,
Jose Vidal
 
 
 
0 Kudos
Message 1 of 2
(3,599 Views)

Software timing means you're at the mercy of Windows to start your loop.  If Windows decides other tasks, like responding to your mouse or keyboard or updating the screen, is more important than your loop, those will go first.  An any given iteration, this can be as muh as 100ms worth of added delay.  If windows adds as little as 5ms on average, you'll fall below 200Hz.  You're working with an excessively unpredictable clock.  It'll be hard to get exactly what you want.

0 Kudos
Message 2 of 2
(3,543 Views)