Main Site Documentation

Problem with pwm (fez panda 2)


#1

Where’s the Bug ? Only f40khz works !! :’(

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

namespace FEZ_Panda_II_40khz_pulse
{
public class Program
{
static PWM pulseur;
static PWM pulseur2;
static PWM f40khz;

    public static void Main()
    {
        bool ledState = false;

        f40khz = new PWM((PWM.Pin)FEZ_Pin.PWM.Di6);
        pulseur = new PWM((PWM.Pin)FEZ_Pin.PWM.Di8);
        pulseur2 = new PWM((PWM.Pin)FEZ_Pin.PWM.Di5);

        // Période 20ms et impulsion haute 1,25ms
        pulseur.SetPulse(20000000, 1250000);
        pulseur2.Set(2000, 10);
        f40khz.Set(40000, 50);

#2

All PWM signals share the same clock frequency. You can have different duty cycle though.