LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

PWM with variable frequency

Solved!
Go to solution

Hi

I would like to know if it is possible to create a PWM with a variable frequency with labview ...

Thanks !

0 Kudos
Message 1 of 23
(12,330 Views)

You can change the PWM frequency by using functions built into the Arduno IDE.  There is no capability built into LIFA for changing the PWM frequency by using the functions built into the Arduino IDE.  If you need this capability you would eed to add this capability to LIFA.  The following two links provide information on changing the PWM frequency. 

<http://playground.arduino.cc/Code/PwmFrequency#.Uz8-V6hdU_o>

<http://playground.arduino.cc/Main/TimerPWMCheatsheet#.Uz9G6qhdU_o>

hrh1818

Message 2 of 23
(6,891 Views)

Thanks but this is not that I would like to do... I try to do a signal with a frequency between 44 and 63 Hz. I know how to do with the code (by using PWM library) but not how to interface with labview... It is possible to control a data with labview? for example my function has "freq" as a parameter and change its value with labview

0 Kudos
Message 3 of 23
(6,891 Views)

Generally, if it's possible with Arduino, it's possible with LabVIEW via Arduino.  If not already available in LIFA, you have to create custom functions to access the functionality.

0 Kudos
Message 4 of 23
(6,891 Views)

Can you control the frequency using the Arduino serial monitor.  If yes it will be easy to control the frequency using Labview.  If you can not control the frequency using the Arduino serial monitor you  will not be able to to control the frequency using Labview.

hrh1818

0 Kudos
Message 5 of 23
(6,891 Views)

I succed in control a parameter in a function. I used a VISA to write on the serial port and it works !

But my problem now is : Labview already uses the serial communication for its interface with the arduino. So there is a conflict between the 2 serial communication ! I can't read 2 differents datas on the same port.... ( not use two times Serial.read()). So I can't use an other simple function in Labview like PWM write for example....

0 Kudos
Message 6 of 23
(6,891 Views)

Were you able to change the frequency when you sent the command via VISA?  If yes, you should post the Arduino code that you used to be able to chagne the frequencey.  That way, we can determine if it's possible to integrate it into LIFA.

0 Kudos
Message 7 of 23
(6,891 Views)

This is my code !

Download All
0 Kudos
Message 8 of 23
(6,891 Views)
Solution
Accepted by topic author maudTU

I created a custom LIFA function based on your Arduino code.  I made some assumptions since I did not have that include file (I was also unable to compile for the same reason).

Take a look at the code to see if my assumptions were correctly.  Let me know if it works.

Download All
0 Kudos
Message 9 of 23
(6,891 Views)

Thanks !

But this is the duty cycle which changes... not the frequency when I put in value between 43 and 61 hz  (the duty cycle decreases while I increase the frequency). After 61 hz, the frequency up to 3 khz... Maybe the default function arduino is not able to make the difference.... it is really weird.

Message 10 of 23
(6,891 Views)