05-07-2013 03:24 AM
Hello,
I'm currently using the LIFA to control a PWM signal but problem is LIFA only allow me to make an 8 bit PWM which resolution is too low for what i'm trying to do. I've started reading arduino and labview code to see if i could easily use the 16-bit PWM with Timer 1 adding this Library http://playground.arduino.cc/Code/Timer1 but i really have no idea where to start from.
So here I am, maybe some of you have already done this.
Thanks for reading this and for any forecoming answer.
05-09-2013 03:13 AM
What are you trying to do with PWM?
05-13-2013 02:39 AM
Well I need it to make a -10 to +10 constant signal and then control a motor through a variator. This signal will be my instruction to regulate the speed of the motor. But 8-bit resolution give me a 0,5V precision only at the end of the process. That's why I need to control the PWM of the 16 bits Timer, at least with a 10bits resolution
05-13-2013 02:58 AM
What motor and what motor controller are you using?
05-17-2013 04:01 AM
Ok, I've finally found some way to do it. I've made a modification in The PWM write Pin VI to add a 4th Command. So now i use a 16bit number as the set value that i split into two 8bits words with an AND fonction. So i now have one 8 bits word and another one with only 2 significants bits.
In the Arduino code, I use this fonction "Timer1.pwm(command[2],(4 * command[3]+command[4]))" to reassemble the two 8bits words as a 10bit set value. That works fine, here is the 16 to 2*8bits VI and arduino code for the case, maybe it will help somebody else.
case 0x0A: // PWM Write Pin
// Define output pin, and its mode
pinMode(command[2], OUTPUT);
// Initialize
Timer1.initialize(5000); // initialize timer1, and set a 1/2 second period
// Note that this breaks analogWrite() for digital pins 9 and 10 on Arduino.
Timer1.pwm(command[2],(4 * command[3]+command[4])); // setup pwm on pin X
Serial.write('0');
break;
Thanks for answering me.
10-10-2013 10:22 AM
Hi Falcoob
I am facing the exact same problem as you were.
However I do not really understand how you widened the resolution of the PWM to 10 bit.
Do you mind explaning it?
\\ Søren
10-10-2013 12:14 PM
You may find it easier to use a 16 bit PWM that has a SPI interface. See:
<http://www.adafruit.com/products/1455>
LIFA has built in support for SPI.
hrh1818
05-18-2014 04:25 AM
Salam,
Working 16 Bit PWM Labview Arduino Uno
just follow the steps in the readme file.
08-31-2018 04:26 PM
Hello I would like to control PWM pin 9 and 10 of the Arduino UNO with 16-bits, right now it is only possible with 8-bits of resolution using LINX, is there a way to do it?