1
/* Copyright (c) 2004 Eric B. Weddington
4
Redistribution and use in source and binary forms, with or without
5
modification, are permitted provided that the following conditions are met:
7
* Redistributions of source code must retain the above copyright
8
notice, this list of conditions and the following disclaimer.
10
* Redistributions in binary form must reproduce the above copyright
11
notice, this list of conditions and the following disclaimer in
12
the documentation and/or other materials provided with the
15
* Neither the name of the copyright holders nor the names of
16
contributors may be used to endorse or promote products derived
17
from this software without specific prior written permission.
19
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
POSSIBILITY OF SUCH DAMAGE. */
31
/* $Id: iom16.h,v 1.7.2.1 2005/01/06 23:26:49 arcanum Exp $ */
33
/* avr/iom16.h - definitions for ATmega16 */
36
#define _AVR_IOM16_H_ 1
38
/* This file should only be included from <avr/io.h>, never directly. */
41
# error "Include <avr/io.h> instead of this file."
45
# define _AVR_IOXXX_H_ "iom16.h"
47
# error "Attempt to include more than one <avr/ioXXX.h> file."
50
/* Registers and associated bit numbers */
52
#define TWBR _SFR_IO8(0x00)
54
#define TWSR _SFR_IO8(0x01)
63
#define TWAR _SFR_IO8(0x02)
73
#define TWDR _SFR_IO8(0x03)
75
/* Combine ADCL and ADCH */
76
#define ADC _SFR_IO16(0x04)
78
#define ADCL _SFR_IO8(0x04)
79
#define ADCH _SFR_IO8(0x05)
81
#define ADCSRA _SFR_IO8(0x06)
91
#define ADMUX _SFR_IO8(0x07)
101
#define ACSR _SFR_IO8(0x08)
111
#define UBRRL _SFR_IO8(0x09)
113
#define UCSRB _SFR_IO8(0x0A)
123
#define UCSRA _SFR_IO8(0x0B)
133
#define UDR _SFR_IO8(0x0C)
135
#define SPCR _SFR_IO8(0x0D)
145
#define SPSR _SFR_IO8(0x0E)
150
#define SPDR _SFR_IO8(0x0F)
152
#define PIND _SFR_IO8(0x10)
162
#define DDRD _SFR_IO8(0x11)
172
#define PORTD _SFR_IO8(0x12)
182
#define PINC _SFR_IO8(0x13)
192
#define DDRC _SFR_IO8(0x14)
202
#define PORTC _SFR_IO8(0x15)
212
#define PINB _SFR_IO8(0x16)
222
#define DDRB _SFR_IO8(0x17)
232
#define PORTB _SFR_IO8(0x18)
242
#define PINA _SFR_IO8(0x19)
252
#define DDRA _SFR_IO8(0x1A)
262
#define PORTA _SFR_IO8(0x1B)
272
/* EEPROM [0x1C..0X1F] The bit numbers are defined in <avr/io.h> */
274
#define UCSRC _SFR_IO8(0x20)
284
#define UBRRH _SFR_IO8(0x20)
287
#define WDTCR _SFR_IO8(0x21)
294
#define ASSR _SFR_IO8(0x22)
300
#define OCR2 _SFR_IO8(0x23)
302
#define TCNT2 _SFR_IO8(0x24)
304
#define TCCR2 _SFR_IO8(0x25)
314
/* Combine ICR1L and ICR1H */
315
#define ICR1 _SFR_IO16(0x26)
317
#define ICR1L _SFR_IO8(0x26)
318
#define ICR1H _SFR_IO8(0x27)
320
/* Combine OCR1BL and OCR1BH */
321
#define OCR1B _SFR_IO16(0x28)
323
#define OCR1BL _SFR_IO8(0x28)
324
#define OCR1BH _SFR_IO8(0x29)
326
/* Combine OCR1AL and OCR1AH */
327
#define OCR1A _SFR_IO16(0x2A)
329
#define OCR1AL _SFR_IO8(0x2A)
330
#define OCR1AH _SFR_IO8(0x2B)
332
/* Combine TCNT1L and TCNT1H */
333
#define TCNT1 _SFR_IO16(0x2C)
335
#define TCNT1L _SFR_IO8(0x2C)
336
#define TCNT1H _SFR_IO8(0x2D)
338
#define TCCR1B _SFR_IO8(0x2E)
347
#define TCCR1A _SFR_IO8(0x2F)
357
#define SFIOR _SFR_IO8(0x30)
366
#define OSCCAL _SFR_IO8(0x31)
368
#define OCDR _SFR_IO8(0x31)
370
#define TCNT0 _SFR_IO8(0x32)
372
#define TCCR0 _SFR_IO8(0x33)
382
#define MCUCSR _SFR_IO8(0x34)
391
#define MCUCR _SFR_IO8(0x35)
401
#define TWCR _SFR_IO8(0x36)
410
#define SPMCR _SFR_IO8(0x37)
419
#define TIFR _SFR_IO8(0x38)
429
#define TIMSK _SFR_IO8(0x39)
439
#define GIFR _SFR_IO8(0x3A)
444
#define GICR _SFR_IO8(0x3B)
451
#define OCR0 _SFR_IO8(0x3C)
453
/* SP [0x3D..0x3E] */
457
/* Interrupt vectors */
458
/* Vector 0 is the reset vector. */
459
#define SIG_INTERRUPT0 _VECTOR(1)
460
#define SIG_INTERRUPT1 _VECTOR(2)
461
#define SIG_OUTPUT_COMPARE2 _VECTOR(3)
462
#define SIG_OVERFLOW2 _VECTOR(4)
463
#define SIG_INPUT_CAPTURE1 _VECTOR(5)
464
#define SIG_OUTPUT_COMPARE1A _VECTOR(6)
465
#define SIG_OUTPUT_COMPARE1B _VECTOR(7)
466
#define SIG_OVERFLOW1 _VECTOR(8)
467
#define SIG_OVERFLOW0 _VECTOR(9)
468
#define SIG_SPI _VECTOR(10)
469
#define SIG_USART_RECV _VECTOR(11)
470
#define SIG_UART_RECV _VECTOR(11) /* For backwards compatibility */
471
#define SIG_USART_DATA _VECTOR(12)
472
#define SIG_UART_DATA _VECTOR(12) /* For backwards compatibility */
473
#define SIG_USART_TRANS _VECTOR(13)
474
#define SIG_UART_TRANS _VECTOR(13) /* For backwards compatibility */
475
#define SIG_ADC _VECTOR(14)
476
#define SIG_EEPROM_READY _VECTOR(15)
477
#define SIG_COMPARATOR _VECTOR(16)
478
#define SIG_2WIRE_SERIAL _VECTOR(17)
479
#define SIG_INTERRUPT2 _VECTOR(18)
480
#define SIG_OUTPUT_COMPARE0 _VECTOR(19)
481
#define SIG_SPM_READY _VECTOR(20)
483
#define _VECTORS_SIZE 84
487
#define SPM_PAGESIZE 128
489
#define XRAMEND 0x45F
491
#define FLASHEND 0x3FFF
493
#endif /* _AVR_IOM16_H_ */
1
/* Copyright (c) 2004 Eric B. Weddington
4
Redistribution and use in source and binary forms, with or without
5
modification, are permitted provided that the following conditions are met:
7
* Redistributions of source code must retain the above copyright
8
notice, this list of conditions and the following disclaimer.
10
* Redistributions in binary form must reproduce the above copyright
11
notice, this list of conditions and the following disclaimer in
12
the documentation and/or other materials provided with the
15
* Neither the name of the copyright holders nor the names of
16
contributors may be used to endorse or promote products derived
17
from this software without specific prior written permission.
19
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
POSSIBILITY OF SUCH DAMAGE. */
31
/* $Id: iom16.h,v 1.13 2005/10/30 22:11:23 joerg_wunsch Exp $ */
33
/* avr/iom16.h - definitions for ATmega16 */
36
#define _AVR_IOM16_H_ 1
38
/* This file should only be included from <avr/io.h>, never directly. */
41
# error "Include <avr/io.h> instead of this file."
45
# define _AVR_IOXXX_H_ "iom16.h"
47
# error "Attempt to include more than one <avr/ioXXX.h> file."
50
/* Registers and associated bit numbers */
52
#define TWBR _SFR_IO8(0x00)
54
#define TWSR _SFR_IO8(0x01)
63
#define TWAR _SFR_IO8(0x02)
73
#define TWDR _SFR_IO8(0x03)
75
/* Combine ADCL and ADCH */
77
#define ADC _SFR_IO16(0x04)
79
#define ADCW _SFR_IO16(0x04)
80
#define ADCL _SFR_IO8(0x04)
81
#define ADCH _SFR_IO8(0x05)
83
#define ADCSRA _SFR_IO8(0x06)
93
#define ADMUX _SFR_IO8(0x07)
103
#define ACSR _SFR_IO8(0x08)
113
#define UBRRL _SFR_IO8(0x09)
115
#define UCSRB _SFR_IO8(0x0A)
125
#define UCSRA _SFR_IO8(0x0B)
135
#define UDR _SFR_IO8(0x0C)
137
#define SPCR _SFR_IO8(0x0D)
147
#define SPSR _SFR_IO8(0x0E)
152
#define SPDR _SFR_IO8(0x0F)
154
#define PIND _SFR_IO8(0x10)
164
#define DDRD _SFR_IO8(0x11)
174
#define PORTD _SFR_IO8(0x12)
184
#define PINC _SFR_IO8(0x13)
194
#define DDRC _SFR_IO8(0x14)
204
#define PORTC _SFR_IO8(0x15)
214
#define PINB _SFR_IO8(0x16)
224
#define DDRB _SFR_IO8(0x17)
234
#define PORTB _SFR_IO8(0x18)
244
#define PINA _SFR_IO8(0x19)
254
#define DDRA _SFR_IO8(0x1A)
264
#define PORTA _SFR_IO8(0x1B)
274
/* EEPROM Control Register */
275
#define EECR _SFR_IO8(0x1C)
281
/* EEPROM Data Register */
282
#define EEDR _SFR_IO8(0x1D)
284
/* EEPROM Address Register */
285
#define EEAR _SFR_IO16(0x1E)
286
#define EEARL _SFR_IO8(0x1E)
287
#define EEARH _SFR_IO8(0x1F)
289
#define UCSRC _SFR_IO8(0x20)
299
#define UBRRH _SFR_IO8(0x20)
302
#define WDTCR _SFR_IO8(0x21)
309
#define ASSR _SFR_IO8(0x22)
315
#define OCR2 _SFR_IO8(0x23)
317
#define TCNT2 _SFR_IO8(0x24)
319
#define TCCR2 _SFR_IO8(0x25)
329
/* Combine ICR1L and ICR1H */
330
#define ICR1 _SFR_IO16(0x26)
332
#define ICR1L _SFR_IO8(0x26)
333
#define ICR1H _SFR_IO8(0x27)
335
/* Combine OCR1BL and OCR1BH */
336
#define OCR1B _SFR_IO16(0x28)
338
#define OCR1BL _SFR_IO8(0x28)
339
#define OCR1BH _SFR_IO8(0x29)
341
/* Combine OCR1AL and OCR1AH */
342
#define OCR1A _SFR_IO16(0x2A)
344
#define OCR1AL _SFR_IO8(0x2A)
345
#define OCR1AH _SFR_IO8(0x2B)
347
/* Combine TCNT1L and TCNT1H */
348
#define TCNT1 _SFR_IO16(0x2C)
350
#define TCNT1L _SFR_IO8(0x2C)
351
#define TCNT1H _SFR_IO8(0x2D)
353
#define TCCR1B _SFR_IO8(0x2E)
362
#define TCCR1A _SFR_IO8(0x2F)
373
The ADHSM bit has been removed from all documentation,
374
as being not needed at all since the comparator has proven
375
to be fast enough even without feeding it more power.
378
#define SFIOR _SFR_IO8(0x30)
387
#define OSCCAL _SFR_IO8(0x31)
389
#define OCDR _SFR_IO8(0x31)
391
#define TCNT0 _SFR_IO8(0x32)
393
#define TCCR0 _SFR_IO8(0x33)
403
#define MCUCSR _SFR_IO8(0x34)
412
#define MCUCR _SFR_IO8(0x35)
422
#define TWCR _SFR_IO8(0x36)
431
#define SPMCR _SFR_IO8(0x37)
440
#define TIFR _SFR_IO8(0x38)
450
#define TIMSK _SFR_IO8(0x39)
460
#define GIFR _SFR_IO8(0x3A)
465
#define GICR _SFR_IO8(0x3B)
472
#define OCR0 _SFR_IO8(0x3C)
474
/* SP [0x3D..0x3E] */
478
/* Interrupt vectors */
479
/* Vector 0 is the reset vector. */
480
/* External Interrupt Request 0 */
481
#define INT0_vect _VECTOR(1)
482
#define SIG_INTERRUPT0 _VECTOR(1)
484
/* External Interrupt Request 1 */
485
#define INT1_vect _VECTOR(2)
486
#define SIG_INTERRUPT1 _VECTOR(2)
488
/* Timer/Counter2 Compare Match */
489
#define TIMER2_COMP_vect _VECTOR(3)
490
#define SIG_OUTPUT_COMPARE2 _VECTOR(3)
492
/* Timer/Counter2 Overflow */
493
#define TIMER2_OVF_vect _VECTOR(4)
494
#define SIG_OVERFLOW2 _VECTOR(4)
496
/* Timer/Counter1 Capture Event */
497
#define TIMER1_CAPT_vect _VECTOR(5)
498
#define SIG_INPUT_CAPTURE1 _VECTOR(5)
500
/* Timer/Counter1 Compare Match A */
501
#define TIMER1_COMPA_vect _VECTOR(6)
502
#define SIG_OUTPUT_COMPARE1A _VECTOR(6)
504
/* Timer/Counter1 Compare Match B */
505
#define TIMER1_COMPB_vect _VECTOR(7)
506
#define SIG_OUTPUT_COMPARE1B _VECTOR(7)
508
/* Timer/Counter1 Overflow */
509
#define TIMER1_OVF_vect _VECTOR(8)
510
#define SIG_OVERFLOW1 _VECTOR(8)
512
/* Timer/Counter0 Overflow */
513
#define TIMER0_OVF_vect _VECTOR(9)
514
#define SIG_OVERFLOW0 _VECTOR(9)
516
/* Serial Transfer Complete */
517
#define SPI_STC_vect _VECTOR(10)
518
#define SIG_SPI _VECTOR(10)
520
/* USART, Rx Complete */
521
#define USART_RXC_vect _VECTOR(11)
522
#define SIG_USART_RECV _VECTOR(11)
523
#define SIG_UART_RECV _VECTOR(11)
525
/* USART Data Register Empty */
526
#define USART_UDRE_vect _VECTOR(12)
527
#define SIG_USART_DATA _VECTOR(12)
528
#define SIG_UART_DATA _VECTOR(12)
530
/* USART, Tx Complete */
531
#define USART_TXC_vect _VECTOR(13)
532
#define SIG_USART_TRANS _VECTOR(13)
533
#define SIG_UART_TRANS _VECTOR(13)
535
/* ADC Conversion Complete */
536
#define ADC_vect _VECTOR(14)
537
#define SIG_ADC _VECTOR(14)
540
#define EE_RDY_vect _VECTOR(15)
541
#define SIG_EEPROM_READY _VECTOR(15)
543
/* Analog Comparator */
544
#define ANA_COMP_vect _VECTOR(16)
545
#define SIG_COMPARATOR _VECTOR(16)
547
/* 2-wire Serial Interface */
548
#define TWI_vect _VECTOR(17)
549
#define SIG_2WIRE_SERIAL _VECTOR(17)
551
/* External Interrupt Request 2 */
552
#define INT2_vect _VECTOR(18)
553
#define SIG_INTERRUPT2 _VECTOR(18)
555
/* Timer/Counter0 Compare Match */
556
#define TIMER0_COMP_vect _VECTOR(19)
557
#define SIG_OUTPUT_COMPARE0 _VECTOR(19)
559
/* Store Program Memory Ready */
560
#define SPM_RDY_vect _VECTOR(20)
561
#define SIG_SPM_READY _VECTOR(20)
563
#define _VECTORS_SIZE 84
567
#define SPM_PAGESIZE 128
569
#define XRAMEND 0x45F
571
#define FLASHEND 0x3FFF
573
#endif /* _AVR_IOM16_H_ */