avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Fine Tuning code timings


From: David Kelly
Subject: Re: [avr-gcc-list] Fine Tuning code timings
Date: Fri, 28 Dec 2007 12:15:41 -0600


On Dec 28, 2007, at 11:00 AM, Jan Menzel wrote:

Hi Alex!
I'd suggest to take larrys approach and generate the start bit from within the ISR. For precise timings you might add the bit time to the current OCR value (insight the ISR). Using this schema you can have an arbitrary (but constant) phase difference between the interrupt and the time of changing the tx-pin. To start a transmission I'd just set the OCR to TIMER + x where x shall be set such that the ISR is called as fast as you like the transmission to start.


That works so long as your interrupt doesn't have to wait on another before it runs.

I recently had a problem where I used one interrupt to service an A/D converter and another for management of the A/D. The A/D responded much faster than I expected and these two interrupts overlapped. Most of the time that was fine but when a 3rd interrupt was running the A/D interrupts queued and were processed in priority order which was reverse of arrival times. Thankfully it was repeatable and occurred at least once every 10 seconds.

If your timing accuracy doesn't mind pseudorandom latencies then manually driving output bits from interrupt is fine. If its picky then connect the OCR timer to its output bit and let the hardware do it.

--
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]