I know the PWM function is implemented using the Output Compare function which are located on specific pins, however - I'm not too sure how the PWM function actually works. I believe those pins run their own timer, so when a value is exceeded - the output is flipped. However, this timer is not one 'running in the main program'. So, does it sound like the above requirement could make best use of an Output Compare capable pin?
I suppose actually, what I am trying to ask - and have just realised it writing the above, is when that condition becomes true at which point I want an output to go high, I want this to generate some sort of "software interrupt" - in that the MCU pauses what it is currently doing and runs an ISR to switch the output on and then returns to the main program, where it can be turned off when another timer is exceeded. Are such "software interrupts" possible?
They have two compare registers so a pin can go high at one value and low at another.
Can you change these values continually whilst the program is running, as described - so that the ISR sets what time you want the output to toggle?
My apologies if that question is answered by the datasheet, it's difficult to know where to look in datasheets of this complexity, compared to the normal discrete component datasheets I'm used to!
Yes, the timers have a lot of options...
I don't want to feed these a PWM signal, I just want to switch a pin high, or low at specific times. Can I not just use any pin for this, and do this within an ISR generated by the timers?
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16