> Well, interrupts are disabled inside ISRs!
I'm well aware of that.
I'm trying to get the ISRs (especially the first one) to be as fast as possible.
This is clipped from the file, it worked in monospaced font.
/----------------------------------------------- Start aquiring A
|
/--------------------------------- Stop aquiring A
| | /------------------------ Start aquiring B
| | | /------------ Stop aquiring B
| | | |
| | | | /----- Start aquiring A again
| | | | | and so on.
Channel A:000000111111110000001111111100000011111111000000111111110000001111111100000011111111
Channel B:000001111111000001111111000001111111000001111111000001111111000001111111000001111111
Channel A is on INT0
Channel B is on INT1
INT0 should fire on the first high edge of channel A, after it is enabled.
The only code that executes in that case is:
TCNT1H=0; // Timer starts at 0
TCNT1L=0;
Raw_Edge_Flag = 0xFF; // Next time is the end of a pulse
Then I exit the ISR.
On the next high edge of channel A, the ISR fires again, and the
following executes:
// Store output into serial buffer
Raw_Data[0][*Raw_Data_In_Pointer] = TCNT1;
GICR |= (0<<INT0)|(1<<INT1); // Disable INT0, Enable INT1
Raw_Edge_Flag = 0; // Next time is the beginning of a pulse
Now if this second part is a little long, that does not matter.
I'm going to then be looking for input on the B channel, and doing the
same thing.
The idea is to capture the period of oscillation of the A channel and
the B channel, as close as possible to the same point in time.Message
Re: [AVR-Chat] Speed of execution
2009-02-24 by David VanHorn
Attachments
- No local attachments were found for this message.