LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

16 Bit PWM Labview Arduino Uno

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.

0 Kudos
Message 1 of 9
(11,278 Views)

What are you trying to do with PWM?

0 Kudos
Message 2 of 9
(6,027 Views)


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

0 Kudos
Message 3 of 9
(6,027 Views)

What motor and what motor controller are you using?

0 Kudos
Message 4 of 9
(6,027 Views)

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.

0 Kudos
Message 5 of 9
(6,027 Views)

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

0 Kudos
Message 6 of 9
(6,027 Views)

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

0 Kudos
Message 7 of 9
(6,027 Views)

Salam,

Working 16 Bit PWM Labview Arduino Uno

just follow the steps in the readme file.

0 Kudos
Message 8 of 9
(6,027 Views)

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?

0 Kudos
Message 9 of 9
(4,650 Views)