Thanks Steven, That was the plan before I realized that I can have the pins changed by hardware, I think it's more repeatable. Anyway, maybe you missed my message that I found a way to set those pins hi. I don't know if PWM would be better, it seems more roundabout, I really can't tell. Thanks again, Cat > To: AVR-Chat@yahoogroups.com > From: s.holder123@btinternet.com > Date: Wed, 7 Oct 2009 07:29:28 +0000 > Subject: [AVR-Chat] Re: Help setting OC1A,B HI on ATMega644p, please. > > hi. > > >One plan could be to set the port operation as normal (COMnA1/COMnB1/ > COMnC1 - COMnA0/COMnB0/COMnC0) to 0, set the compare interrupt bit and write an interrupt handler on compare match, when the interrupt occurs, then set the ports as desired. There will be a degree of interrupt latency especially if there are interrupts occuring, this latency will be variable, but the time between a compare and jumping to the interrupt routine should be small (4 clock cycles min) depending on your timing requirements this should be ok BUT !! due to the nature of latency unless you can be sure NO OTHER INTERRUPTS CAN OCCUR DURING this process the latency is not predictable, it can vary a little. (To minimise the latency further you declare the interrupt as naked, then no context saving is employed before the interrupt is called) > > The way you are doing it seems ok though, when the port function is overidden the port output should be set to the non compared value, ie if you set the port to clear on compare match then it should be set to 1 until the compare occurs. Again in the interrupt handler reset the values you want to set again for the next time, in this mode the pin is set before the interrupt routine is executed, therfore the action is predicatable. > > > although i don't know your system Might PWM mode be more appropiate ? > > [Non-text portions of this message have been removed]
Message
RE: [AVR-Chat] Re: Help setting OC1A,B HI on ATMega644p, please.
2009-10-07 by Cat C
Attachments
- No local attachments were found for this message.