Hello everybody,
i've got a short question:
Is it possible to change the PWM frequency of the PWM pins out of labview? Or can I change the frequencies with an command in the LVIFA_base.pde (similar as described here:http://www.arduino.cc/playground/Main/TimerPWMCheatsheet )?
If it is possible. How can I do it.
After playing around I found that it's possible to include the commands from http://www.arduino.cc/playground/Main/TimerPWMCheatsheet in LVIFA_base.pde . I placed them in the void setup() part under // Place your custom setup code here . Until now I don't receive timing problems, but I don't know whether there is a function in the arduino labview toolkit, that uses millis or delay on the arduino.
I am still interested in a way to set the PWM frequency out of labview.
arzt2283,
You can use the same command but inside the case struture in the LabVIEWInterface.pde file. Then make a corresponding VI to call in LabVIEW. Check out how the digital write VI and firmware work for a simple example.
-Sam K
LIFA Developer
Hi Sammy_K,
Your last comment was really useful. By modifying the LabVIEWInterface.pde code it is possible to integrate the PWM frequency modification, so the frequency can be controlled directly from Labview. (http://forum.arduino.cc/index.php/topic,117425.0.html)
Regards Valentin
can you show your code and block?
First you have to add PWM library (first file). Check if its working (second file).
The third file is the modified LIFA_Base. If you open it on LIFA_Base page #include <PWM.h> and InitTimersSafe(); was added.
On page LabVIEWInterface #include <PWM.h> and at Low Level - PWM Commands:
if (command[2]==7)
{
SetPinFrequencySafe(command[2], command[3]); // this has to be called back for freq modulation
analogWrite(command[2],170);
}
else
{
analogWrite(command[2], command[3]);
}
If you call pin 7, the duty cycle value will define the frequency, duty cycle set to 170.
The fourth file is the VI.
Br, Valentin
can you elaborate more on how to set prescalar setting to 31khz
i tried it this way in vi , but i was not able to get a output from arduino nano