1
0
mirror of https://github.com/mcgurk/Arduino-USB-HID-RetroJoystickAdapter synced 2024-12-21 23:18:56 -05:00

Update README.md

This commit is contained in:
Jarno Lehtinen 2022-04-06 12:03:09 +03:00 committed by GitHub
parent 093f901f7a
commit 93878198ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,22 @@ sei
- lds/sts takes 2 cycles and in/out takes 1 cycle? ldi takes 1 cycle?
- lds/sts: "M" \_SFR_MEM_ADDR(GPIOR2), in/out: "I" \_SFR_IO_ADDR(GPIOR0)
## interrupts
- https://billgrundmann.wordpress.com/2009/03/02/the-overhead-of-arduino-interrupts/
- https://forum.arduino.cc/t/how-fast-can-i-interrupt/25884/5
```
This is from the datasheet for the AT90USB82 processor; things in parenthesis are from me...
The interrupt execution response for all the enabled AVR interrupts is five clock cycles minimum (the processor is fixin' to execute the interrupt)
The vector is normally a jump to the interrupt routine, and this jump takes three clock cycles (the processor jumps to the ISR)
SREG must be saved and restored (the processor doesn't do this for us and SREG is important)
A return from an interrupt handling routine takes three clock cycles
When the AVR exits from an interrupt, it will always return to the main program and execute one more instruction before any pending interrupt is served
Those are the things necessary just to get the ISR called. We have not yet added the application stuff (incrementing an unsigned long in BetterSense's case).
Adding those up gives us 5+3+2+3+1 = 14. The absolute maximum number of interrupts per second that can be handled by the AT90USB82 is 16 million instructions per second / 14 instructions per interrupt = 1,142,857 interrupts per second.
```
## avr asm
- http://www.nongnu.org/avr-libc/user-manual/inline_asm.html
- https://ucexperiment.wordpress.com/2016/03/04/arduino-inline-assembly-tutorial-1/