You must be logged in to reply.

Page 1 of 1 out of 2 messages.

Interrupt on PWM output?

Posted 1yr ago
by ddujmic | Newbie | 12 exp
Posted 1yr ago
by ddujmic | Newbie | 12 exp
HI,

I would like to create two synchronized PWM's with a fixed offset on Panda III:
static PWM Pwm1 = new PWM(FEZPandaIII.PwmOutput.D9, 5000, 110, PWM.ScaleFactor.Microseconds, false);
 static PWM Pwm2 = new PWM(FEZPandaIII.PwmOutput.D6, 5000, 110, PWM.ScaleFactor.Microseconds, false);

and in Main:

InterruptPort Pwm1Int = 
                new InterruptPort(FEZPandaIII.Gpio.D9, false, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeHigh);
            Pwm1Int.OnInterrupt += StartPwm2;


However, there is always an exception thrown by Microsoft.SPOT.Hardware.dll and the Start_Pwm2 never gets called.

Is this a Panda defect?

D
1 like
Reply #1 — Posted 1yr ago
by Reinhard Ostermeier | King | 37,718 exp
Reply #1 — Posted 1yr ago
by Reinhard Ostermeier | King | 37,718 exp
An InterruptPort will try to initialize the pin as an Input port. But the PWM already configured it as an (PWM)Output.
1st: you can not initialize the same pin twize.
2nd: you can not use Interrupts with Outputs.

You could connect the Output pin physically to any other Interrupt capable pin and create the InterruptPort for this one.

Page 1 of 1 out of 2 messages.

You must be logged in to reply.