06-16-2011 12:11 PM
Hi all,
this is the first time I am using the Labview-Arduino Interface and I have a basic (hopefully) question..
I am trying to setup a PWM using arduino via labview to control a proportional solenoid valve. I found the "PWM write pin" function in the Arduin toolbox in Labview and planning to use it.. However, I must also have control over the PWM frequency (set it at 300Hz). I had a quick google look and found this article that shows how to set the PWM frequency in the arduino..
http://www.arduino.cc/playground/Code/PwmFrequency
Therefore I have to create a new arduino sketch (code) to have control over my PWM frequency. Right?
Where do I add this code? Should I edit the LVIFA_Base sketch?
Thanks for your time,
Harry
06-17-2011 04:32 AM
Just in case somebody has the same question...
I managed to set up the PWM frequency by adding the following line of hardware coding just below the "// Place your custom setup code here" in the LVIFA_Base arduino sketch:
TCCR2B = TCCR2B & 0b11111000 | 0x04;
where the 0x04 defines the PWM frequency dividor, explained in detail here:
http://www.arduino.cc/playground/Main/TimerPWMCheatsheet
Cheers,
Harry
07-09-2017 06:58 AM - edited 07-09-2017 07:11 AM