3 years, 9 months ago.

I want to get PWM triggered interrupt.

I need to measure ADC after PWM`s rising edge for my sensorless BLDC motor control. But I don`t know how. Please Help me!

1 Answer

3 years, 9 months ago.

The simplest way would be to loop the PWM output back in to a second pin and use that pin as an interrupt in.

I'm sure there would be a way to do the same thing internal to the processor but it's not supported by the libraries which means that it would involve messing around with the CPU registers directly. You could always try defining the same pin as both a PWM out and an interrupt in. If they are declared in the correct order it may be possible to enable both functions at the same time but it'll require some trial and error to see if it works and it won't be platform independent.