11.07.2015 Views

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ICCV8 <strong>for</strong> AVR – C Compiler <strong>for</strong> Atmel AVR#pragma interrupt_h<strong>and</strong>ler timer0_h<strong>and</strong>ler: iv_TIMER0_OVF#pragma interrupt_h<strong>and</strong>ler eep_h<strong>and</strong>ler: iv_EE_READY#pragma interrupt_h<strong>and</strong>ler adc_h<strong>and</strong>ler: iv_ADCSince interrupt vector number names are defined in <strong>the</strong> header file, <strong>the</strong>y can easily bechanged <strong>for</strong> ano<strong>the</strong>r target AVR by including ano<strong>the</strong>r header file. New targets mustmeet hardware requirements, of course. For names supported by a distinct header,see <strong>the</strong> <strong>avr</strong>_c_lst <strong>and</strong> mega_c_lst files in <strong>the</strong> ICCV8 <strong>for</strong> AVR include directory.Assembly Interrupt H<strong>and</strong>lersYou may write interrupt h<strong>and</strong>lers in assembly. However, if you call C functions inside yourassembly h<strong>and</strong>ler, <strong>the</strong> assembly routine must save <strong>and</strong> restore <strong>the</strong> volatile registers (seeAssembly Interface <strong>and</strong> Calling Conventions), since <strong>the</strong> C functions do not (unless <strong>the</strong>yare declared as interrupt h<strong>and</strong>lers, but <strong>the</strong>n <strong>the</strong>y should not be called directly).If you use assembly interrupt h<strong>and</strong>lers, you must define <strong>the</strong> vectors yourself. Use <strong>the</strong>abs attribute to declare an absolute area (see Assembler Directives) <strong>and</strong> use <strong>the</strong>.org statement to assign <strong>the</strong> rjmp or jmp instruction at <strong>the</strong> right location. Note that<strong>the</strong> .org statement uses byte address.; <strong>for</strong> all but <strong>the</strong> ATMega devices.area vector(abs) ; interrupt vectors.org 0x6rjmp _timer; <strong>for</strong> <strong>the</strong> ATMega devices.area vector(abs) ; interrupt vectors.org 0xCjmp _timerAsm header files aioXXXX.s support macros <strong>for</strong> symbolic interrupt vector definition.Syntax:set_vector_ with as in AVR data sheets <strong>and</strong> equal to <strong>the</strong>user's asm ISR. Examples:set_vector_TIMER0_OVF t0_asm_h<strong>and</strong>lerset_vector_ADCadc_asm_h<strong>and</strong>lerset_vector_UART0_DRE u0dre_asm_h<strong>and</strong>lerDepending on target macro expansion may result in different code. For namessupported by distinct headers, see <strong>the</strong> <strong>avr</strong>_asm_lst <strong>and</strong> mega_asm_lst files in <strong>the</strong>ICCAVR include directory.134

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!