Main Site Documentation

Multiple PWM Problem


#1

Hello all,

First Question, New user to FEZ Panda II.

I want to get 4 PWM output from FEZ Panda with different frequencies. If i use only one pin it works fine. If i use 4 pins with same frequency it works but when i want different frequencies on all PWM pins. Everything is messed up. i get interference on pins and nothing on which i set different frequency.

How can i use 4 PWM Pins with different frequencies.

Like this create interfearence or no output;

using System;
using System.Threading;
using Microsoft.SPOT;
using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Hardware;
using GHIElectronics.NETMF.IO;

namespace FEZ_Mini_Application1
{
class Program
{
public static void Main()
{
PWM L1 = new PWM((PWM.Pin)FEZ_Pin.PWM.Di5);
PWM f1 = new PWM((PWM.Pin)FEZ_Pin.PWM.Di6);
PWM f2 = new PWM((PWM.Pin)FEZ_Pin.PWM.Di8);
PWM f3 = new PWM((PWM.Pin)FEZ_Pin.PWM.Di9);
while (true)
{
L1.SetPulse(50000,44500);
f1.SetPulse(5000000,25000);
f2.SetPulse(100000,44500);
f3.SetPulse(25000,44500);
}
}
}
}

Thank you all


#2

the hardware only supports one frequency for all the PWM outputs.

welcome to forum!


#3

How can i do this is there any other way?
Other Micro-controller based module?


#4

What are you trying to accomplish?


#5

I want to control 4 transistors they have different switching frequencies so for this i need 4 output from micro controller all with different frequencies…
adjestable duty cycle ofcourse…

Frequencies like: 20K , 2K, 100 to 200 HZ


#6

CPLD or FPGA work perfect for such things but it maybe an overkill. Maybe a propeller chip.


#7

Can i use a microcontroller which have more then 4 timers?

and each timer will generate one frequency i desire?


#8

Yes you can.