[CORE:MEMORY:ADMIN:INTERRUPT_VECTOR:FUSE:LOCKBIT:POWER:PROGVOLT:PROGRAMMING:PACKAGE:IO_MODULE:ICE_SETTINGS] V3 AVRSimCore32.SimCoreV3 [] [] [] 32 $00 $1B $1A $1D $1C $1F $1E AVRSimMemory8bit.SimMemory8bit 262144 4096 8192 $200 65536 $2200 $00 $3F $60 $1FF $20 $1FF NA $136 0x010x020x040x080x100x200x400x80 NA $135 0x010x020x040x08 NA $134 0x010x020x040x080x100x200x400x80 NA $132 0x010x020x040x080x100x200x400x80 NA $131 0x010x020x040x080x100x200x400x80 NA $130 0x010x020x040x080x100x200x400x80 NA $12D 0x010x020x040x080x100x200x400x80 NA $12C 0x010x020x040x080x100x200x400x80 NA $12B 0x010x020x040x080x100x200x400x80 NA $12A 0x010x020x040x080x100x200x400x80 NA $129 0x010x020x040x080x100x200x400x80 NA $128 0x010x020x040x080x100x200x400x80 NA $127 0x010x020x040x080x100x200x400x80 NA $126 0x010x020x040x080x100x200x400x80 NA $125 0x010x020x040x080x100x200x400x80 NA $124 0x010x020x040x080x100x200x400x80 NA $122 0x200x400x80 NA $121 0x010x020x040x080x100x400x80 NA $120 0x010x020x040x080x100x200x400x80 NA $10B 0x010x020x040x080x100x200x400x80 NA $10A 0x010x020x040x080x100x200x400x80 NA $109 0x010x020x040x080x100x200x400x80 NA $108 0x010x020x040x080x100x200x400x80 NA $107 0x010x020x040x080x100x200x400x80 NA $106 0x010x020x040x080x100x200x400x80 NA $105 0x010x020x040x080x100x200x400x80 NA $104 0x010x020x040x080x100x200x400x80 NA $103 0x010x020x040x080x100x200x400x80 NA $102 0x010x020x040x080x100x200x400x80 NA $101 0x010x020x040x080x100x200x400x80 NA $100 0x010x020x040x080x100x200x400x80 NA $D6 0x010x020x040x080x100x200x400x80 NA $D5 0x010x020x040x08 NA $D4 0x010x020x040x080x100x200x400x80 NA $D2 0x010x020x040x080x100x200x400x80 NA $D1 0x010x020x040x080x100x200x400x80 NA $D0 0x010x020x040x080x100x200x400x80 NA $CE 0x010x020x040x080x100x200x400x80 NA $CD 0x010x020x040x08 NA $CC 0x010x020x040x080x100x200x400x80 NA $CA 0x010x020x040x080x100x200x400x80 NA $C9 0x010x020x040x080x100x200x400x80 NA $C8 0x010x020x040x080x100x200x400x80 NA $C6 0x010x020x040x080x100x200x400x80 NA $C5 0x010x020x040x08 NA $C4 0x010x020x040x080x100x200x400x80 NA $C2 0x010x020x040x080x100x200x400x80 NA $C1 0x010x020x040x080x100x200x400x80 NA $C0 0x010x020x040x080x100x200x400x80 NA $BD 0x020x040x080x100x200x400x80 NA $BC 0x010x040x080x100x200x400x80 NA $BB 0x010x020x040x080x100x200x400x80 NA $BA 0x010x020x040x080x100x200x400x80 NA $B9 0x010x020x080x100x200x400x80 NA $B8 0x010x020x040x080x100x200x400x80 NA $B6 0x010x020x040x080x100x200x40 NA $B4 0x010x020x040x080x100x200x400x80 NA $B3 0x010x020x040x080x100x200x400x80 NA $B2 0x010x020x040x080x100x200x400x80 NA $B1 0x010x020x040x080x400x80 NA $B0 0x010x020x100x200x400x80 NA $AD 0x010x020x040x080x100x200x400x80 NA $AC 0x010x020x040x080x100x200x400x80 NA $AB 0x010x020x040x080x100x200x400x80 NA $AA 0x010x020x040x080x100x200x400x80 NA $A9 0x010x020x040x080x100x200x400x80 NA $A8 0x010x020x040x080x100x200x400x80 NA $A7 0x010x020x040x080x100x200x400x80 NA $A6 0x010x020x040x080x100x200x400x80 NA $A5 0x010x020x040x080x100x200x400x80 NA $A4 0x010x020x040x080x100x200x400x80 NA $A2 0x200x400x80 NA $A1 0x010x020x040x080x100x400x80 NA $A0 0x010x020x040x080x100x200x400x80 NA $9D 0x010x020x040x080x100x200x400x80 NA $9C 0x010x020x040x080x100x200x400x80 NA $9B 0x010x020x040x080x100x200x400x80 NA $9A 0x010x020x040x080x100x200x400x80 NA $99 0x010x020x040x080x100x200x400x80 NA $98 0x010x020x040x080x100x200x400x80 NA $97 0x010x020x040x080x100x200x400x80 NA $96 0x010x020x040x080x100x200x400x80 NA $95 0x010x020x040x080x100x200x400x80 NA $94 0x010x020x040x080x100x200x400x80 NA $92 0x200x400x80 NA $91 0x010x020x040x080x100x400x80 NA $90 0x010x020x040x080x100x200x400x80 NA $8D 0x010x020x040x080x100x200x400x80 NA $8C 0x010x020x040x080x100x200x400x80 NA $8B 0x010x020x040x080x100x200x400x80 NA $8A 0x010x020x040x080x100x200x400x80 NA $89 0x010x020x040x080x100x200x400x80 NA $88 0x010x020x040x080x100x200x400x80 NA $87 0x010x020x040x080x100x200x400x80 NA $86 0x010x020x040x080x100x200x400x80 NA $85 0x010x020x040x080x100x200x400x80 NA $84 0x010x020x040x080x100x200x400x80 NA $82 0x200x400x80 NA $81 0x010x020x040x080x100x400x80 NA $80 0x010x020x040x080x100x200x400x80 NA $7F 0x010x02 NA $7E 0x010x020x040x080x100x200x400x80 NA $7D 0x010x020x040x080x100x200x400x80 NA $7C 0x010x020x040x080x100x200x400x80 NA $7B 0x400x010x020x040x08 NA $7A 0x010x020x040x080x100x200x400x80 NA $79 0x010x020x040x080x100x200x400x80 NA $78 0x010x020x040x080x100x200x400x80 NA $75 0x010x020x040x80 NA $74 0x010x020x040x080x100x200x400x80 NA $73 0x010x020x040x080x20 NA $72 0x010x020x040x080x20 NA $71 0x010x020x040x080x20 NA $70 0x010x020x04 NA $6F 0x010x020x040x080x20 NA $6E 0x010x020x04 NA $6D 0x010x020x040x080x100x200x400x80 NA $6C 0x010x020x040x080x100x200x400x80 NA $6B 0x010x020x040x080x100x200x400x80 NA $6A 0x010x020x040x080x100x200x400x80 NA $69 0x010x020x040x080x100x200x400x80 NA $68 0x010x020x04 NA $66 0x010x020x040x080x100x200x400x80 NA $65 0x010x020x040x080x100x20 NA $64 0x010x020x040x080x200x400x80 NA $61 0x010x020x040x080x80 NA $60 0x010x020x040x080x100x200x400x80 $3F $5F 0x010x020x040x080x100x200x400x80 $3E $5E 0x21 0x010x020x040x080x100x200x400x80 $3D $5D 0xFF 0x010x020x040x080x100x200x400x80 $3C $5C 0x01 $3B $5B 0x010x02 $37 $57 0x010x020x040x080x100x200x400x80 $35 $55 0x800x010x020x10 $34 $54 0x100x010x020x040x08 $33 $53 0x010x020x040x08 $31 $51 0x010x020x040x080x100x200x400x80 $30 $50 0x010x020x040x080x100x200x400x80 $2E $4E 0x010x020x040x080x100x200x400x80 $2D $4D 0x010x400x80 $2C $4C 0x010x020x040x080x100x200x400x80 $2B $4B 0x010x020x040x080x100x200x400x80 $2A $4A 0x010x020x040x080x100x200x400x80 $28 $48 0x010x020x040x080x100x200x400x80 $27 $47 0x010x020x040x080x100x200x400x80 $26 $46 0x010x020x040x080x100x200x400x80 $25 $45 0x010x020x040x080x400x80 $24 $44 0x010x020x100x200x400x80 $23 $43 0x010x800x02 $22 $42 0x010x020x040x08 $21 $41 0x010x020x040x080x100x200x400x80 $20 $40 0x010x020x040x080x100x200x400x80 $1F $3F 0x010x020x040x080x100x20 $1E $3E 0x010x020x040x080x100x200x400x80 $1D $3D 0x010x020x040x080x100x200x400x80 $1C $3C 0x010x020x040x080x100x200x400x80 $1B $3B 0x010x020x04 $1A $3A 0x010x020x040x080x20 $19 $39 0x010x020x040x080x20 $18 $38 0x010x020x040x080x20 $17 $37 0x010x020x04 $16 $36 0x010x020x040x080x20 $15 $35 0x010x020x04 $14 $34 0x010x020x040x080x100x20 $13 $33 0x010x020x040x080x100x20 $12 $32 0x010x020x040x080x100x20 $11 $31 0x010x020x040x080x100x200x400x80 $10 $30 0x010x020x040x080x100x200x400x80 $0F $2F 0x010x020x040x080x100x200x400x80 $0E $2E 0x010x020x040x080x100x200x400x80 $0D $2D 0x010x020x040x080x100x200x400x80 $0C $2C 0x010x020x040x080x100x200x400x80 $0B $2B 0x010x020x040x080x100x200x400x80 $0A $2A 0x010x020x040x080x100x200x400x80 $09 $29 0x010x020x040x080x100x200x400x80 $08 $28 0x010x020x040x080x100x200x400x80 $07 $27 0x010x020x040x080x100x200x400x80 $06 $26 0x010x020x040x080x100x200x400x80 $05 $25 0x010x020x040x080x100x200x400x80 $04 $24 0x010x020x040x080x100x200x400x80 $03 $23 0x010x020x040x080x100x200x400x80 $02 $22 0x010x020x040x080x100x200x400x80 $01 $21 0x010x020x040x080x100x200x400x80 $00 $20 0x010x020x040x080x100x200x400x80 $1F000 $1FFFF $0000 $1EFFF 128 512 4 $0000 $1FE00 $1FE00 1024 8 $0000 $1FC00 $1FC00 2048 16 $0000 $1F800 $1F800 4096 32 $0000 $1F000 $1F000 ATmega2560 16MHZ 98 RELEASED $1E $98 $01 57 $000 RESET External Pin,Power-on Reset,Brown-out Reset,Watchdog Reset,and JTAG AVR Reset. See Datasheet. $002 INT0 External Interrupt Request 0 $004 INT1 External Interrupt Request 1 $006 INT2 External Interrupt Request 2 $008 INT3 External Interrupt Request 3 $00A INT4 External Interrupt Request 4 $00C INT5 External Interrupt Request 5 $00E INT6 External Interrupt Request 6 $010 INT7 External Interrupt Request 7 $012 PCINT0 Pin Change Interrupt Request 0 $014 PCINT1 Pin Change Interrupt Request 1 $016 PCINT2 Pin Change Interrupt Request 2 $018 WDT Watchdog Time-out Interrupt $01A TIMER2_COMPA Timer/Counter2 Compare Match A $01C TIMER2_COMPB Timer/Counter2 Compare Match B $01E TIMER2_OVF Timer/Counter2 Overflow $020 TIMER1_CAPT Timer/Counter1 Capture Event $022 TIMER1_COMPA Timer/Counter1 Compare Match A $024 TIMER1_COMPB Timer/Counter1 Compare Match B $026 TIMER1_COMPC Timer/Counter1 Compare Match C $028 TIMER1_OVF Timer/Counter1 Overflow $02A TIMER0_COMPA Timer/Counter0 Compare Match A $02C TIMER0_COMPB Timer/Counter0 Compare Match B $02E TIMER0_OVF Timer/Counter0 Overflow $030 SPI, STC SPI Serial Transfer Complete $032 USART0, RX USART0, Rx Complete $034 USART0, UDRE USART0 Data register Empty $036 USART0, TX USART0, Tx Complete $038 ANALOG_COMP Analog Comparator $03A ADC ADC Conversion Complete $03C EE_READY EEPROM Ready $03E TIMER3_CAPT Timer/Counter3 Capture Event $040 TIMER3_COMPA Timer/Counter3 Compare Match A $042 TIMER3_COMPB Timer/Counter3 Compare Match B $044 TIMER3_COMPC Timer/Counter3 Compare Match C $046 TIMER3_OVF Timer/Counter3 Overflow $048 USART1, RX USART1, Rx Complete $04A USART1, UDRE USART1 Data register Empty $04C USART1, TX USART1, Tx Complete $04E TWI 2-wire Serial Interface $050 SPM_READY Store Program Memory Read $052 TIMER4_CAPT Timer/Counter4 Capture Event $054 TIMER4_COMPA Timer/Counter4 Compare Match A $056 TIMER4_COMPB Timer/Counter4 Compare Match B $058 TIMER4_COMPC Timer/Counter4 Compare Match C $05A TIMER4_OVF Timer/Counter4 Overflow $05C TIMER5_CAPT Timer/Counter5 Capture Event $05E TIMER5_COMPA Timer/Counter5 Compare Match A $060 TIMER5_COMPB Timer/Counter5 Compare Match B $062 TIMER5_COMPC Timer/Counter5 Compare Match C $064 TIMER5_OVF Timer/Counter5 Overflow $066 USART2, RX USART2, Rx Complete $068 USART2, UDRE USART2 Data register Empty $06A USART2, TX USART2, Tx Complete $06C USART3, RX USART3, Rx Complete $06E USART3, UDRE USART3 Data register Empty $070 USART3, TX USART3, Tx Complete [LOW:HIGH:EXTENDED] 8 CLKDIV8 Divide clock by 8 0 CKOUT Clock output 1 SUT1 Select start-up time 0 SUT0 Select start-up time 0 CKSEL3 Select Clock Source 0 CKSEL2 Select Clock Source 0 CKSEL1 Select Clock Source 1 CKSEL0 Select Clock Source 0 57 0x80 0x00 Divide clock by 8 internally; [CKDIV8=0] 0x40 0x00 Clock output on PORTE7; [CKOUT=0] 0x3F 0x00 Ext. Clock; Start-up time: 6 CK + 0 ms; [CKSEL=0000 SUT=00] 0x3F 0x10 Ext. Clock; Start-up time: 6 CK + 4.1 ms; [CKSEL=0000 SUT=01] 0x3F 0x20 Ext. Clock; Start-up time: 6 CK + 65 ms; [CKSEL=0000 SUT=10] 0x3F 0x02 Int. RC Osc.; Start-up time: 6 CK + 0 ms; [CKSEL=0010 SUT=00] 0x3F 0x12 Int. RC Osc.; Start-up time: 6 CK + 4.1 ms; [CKSEL=0010 SUT=01] 0x3F 0x22 Int. RC Osc.; Start-up time: 6 CK + 65 ms; [CKSEL=0010 SUT=10] 0x3F 0x03 Int. 128kHz RC Osc.; Start-up time: 6 CK + 0 ms; [CKSEL=0011 SUT=00] 0x3F 0x13 Int. 128kHz RC Osc.; Start-up time: 6 CK + 4 ms; [CKSEL=0011 SUT=01] 0x3F 0x23 Int. 128kHz RC Osc.; Start-up time: 6 CK + 64 ms; [CKSEL=0011 SUT=10] 0x3F 0x04 Ext. Low-Freq. Crystal; Start-up time: 1K CK + 0 ms; [CKSEL=0100 SUT=00] 0x3F 0x14 Ext. Low-Freq. Crystal; Start-up time: 1K CK + 4.1 ms; [CKSEL=0100 SUT=01] 0x3F 0x24 Ext. Low-Freq. Crystal; Start-up time: 1K CK + 65 ms; [CKSEL=0100 SUT=10] 0x3F 0x05 Ext. Low-Freq. Crystal; Start-up time: 32K CK + 0 ms; [CKSEL=0101 SUT=00] 0x3F 0x15 Ext. Low-Freq. Crystal; Start-up time: 32K CK + 4.1 ms; [CKSEL=0101 SUT=01] 0x3F 0x25 Ext. Low-Freq. Crystal; Start-up time: 32K CK + 65 ms; [CKSEL=0101 SUT=10] 0x3F 0x06 Full Swing Oscillator; Start-up time: 258 CK + 4.1 ms; Ceramic res.; fast rising power; [CKSEL=0110 SUT=00] 0x3F 0x16 Full Swing Oscillator; Start-up time: 258 CK + 65 ms; Ceramic res.; slowly rising power; [CKSEL=0110 SUT=01] 0x3F 0x26 Full Swing Oscillator; Start-up time: 1K CK + 0 ms; Ceramic res.; BOD enable; [CKSEL=0110 SUT=10] 0x3F 0x36 Full Swing Oscillator; Start-up time: 1K CK + 4.1 ms; Ceramic res.; fast rising power; [CKSEL=0110 SUT=11] 0x3F 0x07 Full Swing Oscillator; Start-up time: 1K CK + 65 ms; Ceramic res.; slowly rising power; [CKSEL=0111 SUT=00] 0x3F 0x17 Full Swing Oscillator; Start-up time: 16K CK + 0 ms; Crystal Osc.; BOD enabled; [CKSEL=0111 SUT=01] 0x3F 0x27 Full Swing Oscillator; Start-up time: 16K CK + 4.1 ms; Crystal Osc.; fast rising power; [CKSEL=0111 SUT=10] 0x3F 0x37 Full Swing Oscillator; Start-up time: 16K CK + 65 ms; Crystal Osc.; slowly rising power; [CKSEL=0111 SUT=11] 0x3F 0x08 Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 4.1 ms; [CKSEL=1000 SUT=00] 0x3F 0x18 Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 258 CK + 65 ms; [CKSEL=1000 SUT=01] 0x3F 0x28 Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 0 ms; [CKSEL=1000 SUT=10] 0x3F 0x38 Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 4.1 ms; [CKSEL=1000 SUT=11] 0x3F 0x09 Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 1K CK + 65 ms; [CKSEL=1001 SUT=00] 0x3F 0x19 Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 0 ms; [CKSEL=1001 SUT=01] 0x3F 0x29 Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 4.1 ms; [CKSEL=1001 SUT=10] 0x3F 0x39 Ext. Crystal Osc.; Frequency 0.4-0.9 MHz; Start-up time: 16K CK + 65 ms; [CKSEL=1001 SUT=11] 0x3F 0x0A Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 4.1 ms; [CKSEL=1010 SUT=00] 0x3F 0x1A Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 258 CK + 65 ms; [CKSEL=1010 SUT=01] 0x3F 0x2A Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 0 ms; [CKSEL=1010 SUT=10] 0x3F 0x3A Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 4.1 ms; [CKSEL=1010 SUT=11] 0x3F 0x0B Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 1K CK + 65 ms; [CKSEL=1011 SUT=00] 0x3F 0x1B Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 0 ms; [CKSEL=1011 SUT=01] 0x3F 0x2B Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 4.1 ms; [CKSEL=1011 SUT=10] 0x3F 0x3B Ext. Crystal Osc.; Frequency 0.9-3.0 MHz; Start-up time: 16K CK + 65 ms; [CKSEL=1011 SUT=11] 0x3F 0x0C Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 4.1 ms; [CKSEL=1100 SUT=00] 0x3F 0x1C Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 258 CK + 65 ms; [CKSEL=1100 SUT=01] 0x3F 0x2C Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 0 ms; [CKSEL=1100 SUT=10] 0x3F 0x3C Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 4.1 ms; [CKSEL=1100 SUT=11] 0x3F 0x0D Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 1K CK + 65 ms; [CKSEL=1101 SUT=00] 0x3F 0x1D Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 0 ms; [CKSEL=1101 SUT=01] 0x3F 0x2D Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 4.1 ms; [CKSEL=1101 SUT=10] 0x3F 0x3D Ext. Crystal Osc.; Frequency 3.0-8.0 MHz; Start-up time: 16K CK + 65 ms; [CKSEL=1101 SUT=11] 0x3F 0x0E Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 4.1 ms; [CKSEL=1110 SUT=00] 0x3F 0x1E Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 258 CK + 65 ms; [CKSEL=1110 SUT=01] 0x3F 0x2E Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 0 ms; [CKSEL=1110 SUT=10] 0x3F 0x3E Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 4.1 ms; [CKSEL=1110 SUT=11] 0x3F 0x0F Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 1K CK + 65 ms; [CKSEL=1111 SUT=00] 0x3F 0x1F Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 0 ms; [CKSEL=1111 SUT=01] 0x3F 0x2F Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 4.1 ms; [CKSEL=1111 SUT=10] 0x3F 0x3F Ext. Crystal Osc.; Frequency 8.0- MHz; Start-up time: 16K CK + 65 ms; [CKSEL=1111 SUT=11] 8 OCDEN Enable OCD 1 JTAGEN Enable JTAG 0 SPIEN Enable Serial programming and Data Downloading 0 WDTON Watchdog timer always on 1 EESAVE EEPROM memory is preserved through chip erase 1 BOOTSZ1 Select Boot Size 0 BOOTSZ0 Select Boot Size 0 BOOTRST Select Reset Vector 1 10 0x80 0x00 On-Chip Debug Enabled; [OCDEN=0] 0x40 0x00 JTAG Interface Enabled; [JTAGEN=0] 0x20 0x00 Serial program downloading (SPI) enabled; [SPIEN=0] 0x10 0x00 Watchdog timer always on; [WDTON=0] 0x08 0x00 Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0] 0x06 0x06 Boot Flash section size=512 words Boot start address=$1FE00; [BOOTSZ=11] 0x06 0x04 Boot Flash section size=1024 words Boot start address=$1FC00; [BOOTSZ=10] 0x06 0x02 Boot Flash section size=2408 words Boot start address=$1E800; [BOOTSZ=01] 0x06 0x00 Boot Flash section size=4096 words Boot start address=$1F000; [BOOTSZ=00] ; default value 0x01 0x00 Boot Reset vector Enabled (default address=$0000); [BOOTRST=0] 3 BODLEVEL2 Brown-out Detector trigger level 1 BODLEVEL1 Brown-out Detector trigger level 1 BODLEVEL0 Brown-out Detector trigger level 1 4 0x07 0x07 Brown-out detection disabled; [BODLEVEL=111] 0x07 0x06 Brown-out detection level at VCC=1.8 V; [BODLEVEL=110] 0x07 0x05 Brown-out detection level at VCC=2.7 V; [BODLEVEL=101] 0x07 0x04 Brown-out detection level at VCC=4.3 V; [BODLEVEL=100] [LB1 = 1 : LB2 = 1] No memory lock features enabled. [LB1 = 0 : LB2 = 1] Further programming of Flash and EEPROM is enabled. [LB1 = 0 : LB2 = 0] Same as previous, but verify is also disabled 6 11 0x03 0x03 Mode 1: No memory lock features enabled 0x03 0x02 Mode 2: Further programming disabled 0x03 0x00 Mode 3: Further programming and verification disabled 0x0C 0x0C Application Protection Mode 1: No lock on SPM and LPM in Application Section 0x0C 0x08 Application Protection Mode 2: SPM prohibited in Application Section 0x0C 0x00 Application Protection Mode 3: LPM and SPM prohibited in Application Section 0x0C 0x04 Application Protection Mode 4: LPM prohibited in Application Section 0x30 0x30 Boot Loader Protection Mode 1: No lock on SPM and LPM in Boot Loader Section 0x30 0x20 Boot Loader Protection Mode 2: SPM prohibited in Boot Loader Section 0x30 0x00 Boot Loader Protection Mode 3: LPM and SPM prohibited in Boot Loader Section 0x30 0x10 Boot Loader Protection Mode 4: LPM prohibited in Boot Loader Section LB1 Lock bit LB2 Lock bit BLB01 Boot Lock bit BLB02 Boot Lock bit BLB11 Boot lock bit BLB12 Boot lock bit 4MHz 25C 5.0mA 2.2mA <3uA 2.7 6.0 4.5 5.5 0xff,0xdf 0xff,0xdf 1,0x40,0x40,WARNING! These fuse settings will disable the JTAG interface! 1,0x20,0x20,WARNING! These fuse settings will disable the ISP interface! 1,0x40,0x40,WARNING! These fuse settings will disable the JTAG interface! 1,0x20,0x20,WARNING! These fuse settings will disable the ISP interface! 1,0x40,0x40,WARNING! These fuse settings will disable the JTAG interface! 1,0x20,0x20,WARNING! These fuse settings will disable the ISP interface! 0x00,8.0 MHz 256 8 [TQFP] 100 [OC0B] [PG5] [RXD:PCINT8] [PE0] [TXD0] [PE1] [XCK:AIN0] [PE2] [OC3A:AIN1] [PE3] [OC3B:INT4] [PE4] [OC3C:INT5] [PE5 [T3:INT6] [PE6] [CLKO:ICP3:INT7] [PE7] [VCC] [GND] [RXD2] [PH0] [TXD2] [PH1] [XCK2] [PH2] [OC4A] [PH3] [OC4B] [PH4] [OC4C] [PH5 [OC2B] [PH6] ['SS:PCINT0] [PB0] [SCK:PCINT1] [PB1] [MOSI:PCINT2] [PB2] [MISO:PCINT3] [PB3] [OC0A:PCINT4] [PB4] [OC1A:PCINT5] [PB5 [OC1B:PCINT6] [PB6] [OC0A:OC1C:PCINT7] [PB7] [T4] [PH7] [TOSC2] [PG3] [TOSC1] [PG4] ['RESET] [VCC] [GND] [XTAL2] [XTAL1] [ICP4] [PL0] [ICP5] [PL1] [T5] [PL2] [OC5A] [PL3] [OC5B] [PL4] [OC5C] [PL5 [PL6] [PL7] [SCL:INT0] [PD0] [SDA:INT1] [PD1] [RXD1:INT2] [PD2] [TXD1:INT3] [PD3] [ICP1] [PD4] [XCK1] [PD5] [T1] [PD6] [T0] [PD7] ['WR] [PG0] ['RD] [PG1] [A8] [PC0] [A9] [PC1] [A10] [PC2] [A11] [PC3] [A12] [PC4] [A13] [PC5] [A14] [PC6] [A15] [PC7] [VCC] [GND] [RXD3:PCINT9] [PJ0] [TXD3:PCINT10] [PJ1] [XCK3:PCINT11] [PJ2] [PCINT12] [PJ3] [PCINT13] [PJ4] [PCINT14] [PJ5 [PCINT15] [PJ6] [ALE] [PG2] [AD7] [PA7] [AD6] [PA6] [AD5] [PA5] [AD4] [PA4] [AD3] [PA3] [AD2] [PA2] [AD1] [PA1] [AD0] [PA0] [PJ7] [VCC] [GND] [ADC15:PCINT23] [PK7] [ADC14:PCINT22] [PK6] [ADC13:PCINT21] [PK5] [ADC12:PCINT20] [PK4] [ADC11:PCINT19] [PK3] [ADC10:PCINT18] [PK2] [ADC9:PCINT17] [PK1] [ADC8:PCINT16] [PK0] [ADC7:TDI] [PF7] [ADC6:TDO] [PF6] [ADC5:TMS] [PF5 [ADC4:TCK] [PF4] [ADC3] [PF3] [ADC2] [PF2] [ADC1] [PF1] [ADC0] [PF0] [AREF] [AGND] [AVCC] [ANALOG_COMPARATOR:USART0:TWI:SPI:PORTA:PORTB:PORTC:PORTD:PORTE:PORTF:PORTG:PORTH:PORTJ:PORTK:PORTL:TIMER_COUNTER_0:TIMER_COUNTER_2:WATCHDOG:USART1:EEPROM:TIMER_COUNTER_5:TIMER_COUNTER_4:TIMER_COUNTER_3:TIMER_COUNTER_1:JTAG:EXTERNAL_INTERRUPT:CPU:AD_CONVERTER:BOOT_LOAD:USART2:USART3] [ADCSRB:ACSR:DIDR1] io_analo.bmp AlgComp_01 ADCSRB ADC Control and Status Register B NA $7B io_flag.bmp Y ACME Analog Comparator Multiplexer Enable When this bit is written logic one and the ADC is switched off (ADEN in ADCSR is zero), the ADC multiplexer selects the negative input to the Analog Comparator. When this bit is written logic zero, AIN1 is applied to the negative input of the Analog Comparator. For a detailed description of this bit, see “Analog Comparator Multiplexed Input” on page 186. RW 0 ACSR Analog Comparator Control And Status Register $30 $50 io_analo.bmp Y ACD Analog Comparator Disable When this bit is written logic one, the power to the analog comparator is switched off. This bit can be set at any time to turn off the analog comparator. This will reduce power consumption in active and idle mode. When changing the ACD bit, the Analog Comparator Interrupt must be disabled by clearing the ACIE bit in ACSR. Otherwise an interrupt can occur when the bit is changed. RW 0 ACBG Analog Comparator Bandgap Select When this bit is set, a fixed bandgap reference voltage replaces the positive input to the Analog Comparator. When this bit is cleared, AIN0 is applied to the positive input of the Analog Comparator. See “Internal Voltage Reference” on page 42. RW 0 ACO Analog Compare Output The output of the analog comparator is synchronized and then directly connected to ACO. The synchronization introduces a delay of 1-2 clock cycles. R NA ACI Analog Comparator Interrupt Flag This bit is set by hardware when a comparator output event triggers the interrupt mode defined by ACIS1 and ACIS0. The Analog Comparator Interrupt routine is executed if the ACIE bit is set and the I-bit in SREG is set. ACI is cleared by hard-ware when executing the corresponding interrupt handling vector. Alternatively, ACI is cleared by writing a logic one to the flag. RW 0 ACIE Analog Comparator Interrupt Enable When the ACIE bit is written logic one and the I-bit in the Status Register is set, the analog comparator interrupt is acti-vated. When written logic zero, the interrupt is disabled. RW 0 ACIC Analog Comparator Input Capture Enable When written logic one, this bit enables the Input Capture function in Timer/Counter1 to be triggered by the analog comparator. The comparator output is in this case directly connected to the Input Capture front-end logic, making the comparator utilize the noise canceler and edge select features of the Timer/Counter1 Input Capture interrupt. When written logic zero, no connection between the analog comparator and the Input Capture function exists. To make the comparator trigger the Timer/Counter1 Input Capture interrupt, the TICIE1 bit in the Timer Interrupt Mask Register (TIMSK) must be set RW 0 ACIS1 Analog Comparator Interrupt Mode Select bit 1 These bits determine which comparator events that trigger the Analog Comparator interrupt. RW 0 ACIS0 Analog Comparator Interrupt Mode Select bit 0 These bits determine which comparator events that trigger the Analog Comparator interrupt. RW 0 DIDR1 Digital Input Disable Register 1 NA $7F io_analo.bmp Y AIN1D AIN1 Digital Input Disable When this bit is written logic one,the digital input buffer on the AIN1/0 pin is disabled.The corresponding PIN register bit will always read as zero when this bit is set.When an analog signal is applied to the AIN1/0 pin and the digital input from this pin is not needed,this bit should be written logic one to reduce power consumption in the digital input buffer. RW 0 AIN0D AIN0 Digital Input Disable When this bit is written logic one,the digital input buffer on the AIN1/0 pin is disabled.The corresponding PIN register bit will always read as zero when this bit is set.When an analog signal is applied to the AIN1/0 pin and the digital input from this pin is not needed,this bit should be written logic one to reduce power consumption in the digital input buffer. RW 0 [UDR0:UCSR0A:UCSR0B:UCSR0C:UBRR0H:UBRR0L] [UBRR0H:UBRR0L] io_com.bmp The Universal Synchronous and Asynchronous serial Receiver and Transmitter (USART) is a highly flexible serial communication device. The main features are: • Full Duplex Operation (Independent Serial Receive and Transmit Registers) • Asynchronous or Synchronous Operation • Master or Slave Clocked Synchronous Operation • High Resolution Baud Rate Generator • Supports Serial Frames with 5, 6, 7, 8 or 9 Data Bits and 1 or 2 Stop Bits • Odd or Even Parity Generation and Parity Check Supported by Hardware • Data OverRun Detection • Framing Error Detection • Noise Filtering Includes False Start Bit Detection and Digital Low Pass Filter • Three Separate Interrupts on TX Complete, TX Data Register Empty and RX Complete • Multi-processor Communication Mode • Double Speed Asynchronous Communica UDR0 USART I/O Data Register The UDR0 register is actually two physically separate registers sharing the same I/O address. When writing to the register, the USART Transmit Data register is written. When reading from UDR0, the USART Receive Data register is read. NA $C6 io_com.bmp N UDR0-7 USART I/O Data Register bit 7 RW 0 UDR0-6 USART I/O Data Register bit 6 RW 0 UDR0-5 USART I/O Data Register bit 5 RW 0 UDR0-4 USART I/O Data Register bit 4 RW 0 UDR0-3 USART I/O Data Register bit 3 RW 0 UDR0-2 USART I/O Data Register bit 2 RW 0 UDR0-1 USART I/O Data Register bit 1 RW 0 UDR0-0 USART I/O Data Register bit 0 RW 0 UCSR0A USART Control and Status Register A NA $C0 io_flag.bmp Y RXC0 USART Receive Complete This bit is set (one) when a received character is transferred from the Receiver Shift register to UDR0. The bit is set regard-less of any detected framing errors. When the RXCIE bit in UCR is set, the USART Receive Complete interrupt will be executed when RXC is set(one). RXC is cleared by reading UDR0. When interrupt-driven data reception is used, the USART Receive Complete Interrupt routine must read UDRin order to clear RXC, otherwise a new interrupt will occur once the interrupt routine terminates. R 0 TXC0 USART Transmitt Complete This bit is set (one) when the entire character (including the stop bit) in the Transmit Shift register has been shifted out and no new data has been written to UDR0. This flag is especially useful in half-duplex communications interfaces, where a transmitting application must enter receive mode and free the communications bus immediately after completing the transmission. When the TXCIE bit in UCR is set, setting of TXC causes the USART Transmit Complete interrupt to be executed. TXC is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, the TXC bit is cleared (zero) by writing a logical one to the b RW 0 UDRE0 USART Data Register Empty This bit is set (one) when a character written to UDRis transferred to the Transmit shift register. Setting of this bit indicates that the transmitter is ready to receive a new character for transmission. When the UDR0IE bit in UCR is set, the USART Transmit Complete interrupt to be executed as long as UDR0E is set. UDR0E is cleared by writing UDR0. When interrupt-driven data transmittal is used, the USART Data Register Empty Interrupt routine must write UDRin order to clear UDR0E, otherwise a new interrupt will occur once the interrupt routine terminates. UDR0E is set (one) during reset to indicate that the transmitter is re R 1 FE0 Framing Error This bit is set if a Framing Error condition is detected, i.e. when the stop bit of an incoming character is zero. The FE bit is cleared when the stop bit of received data is one. R 0 DOR0 Data overRun This bit is set if an Overrun condition is detected, i.e. when a character already present in the UDRregister is not read before the next character has been shifted into the Receiver Shift register. The OR bit is buffered, which means that it will be set once the valid data still in UDR0E is read. The OR bit is cleared (zero) when data is received and transferred to UDR0. R 0 UPE0 Parity Error This bit is set if the next character in the receive buffer had a Parity Error when received and the parity checking was enabled at that point (UPM1 = 1). This bit is valid until the receive buffer (UDR0) is read. Always set this bit to zero when writing to UCSR0A. R 0 U2X0 Double the USART transmission speed This bit only has effect for the asynchronous operation. Write this bit to zero when using synchronous operation. Writing this bit to one will reduce the divisor of the baud rate divider from 16 to 8 effectively doubling the transfer rate for asynchronous communication. RW 0 MPCM0 Multi-processor Communication Mode This bit enables the Multi-processor Communication Mode. When the MPCM bit is written to one, all the incoming frames received by the USART receiver that do not contain address information will be ignored. The transmitter is unaffected by the MPCM setting. For more detailed information see “Multi-processor Communication Mode” on page 152. RW 0 UCSR0B USART Control and Status Register B NA $C1 io_flag.bmp Y RXCIE0 RX Complete Interrupt Enable Writing this bit to one enables interrupt on the RXC flag. A USART Receive Complete interrupt will be generated only if the RXCIE bit is written to one, the global interrupt flag in SREG is written to one and the RXC bit in UCSR0A is set. RW 0 TXCIE0 TX Complete Interrupt Enable Writing this bit to one enables interrupt on the TXC flag. A USART Transmit Complete interrupt will be generated only if the TXCIE bit is written to one, the global interrupt flag in SREG is written to one and the TXC bit in UCSR0A is set. RW 0 UDRIE0 USART Data register Empty Interrupt Enable Writing this bit to one enables interrupt on the UDR0E flag. A Data Register Empty interrupt will be generated only if the UDR0IE bit is written to one, the global interrupt flag in SREG is written to one and the UDR0E bit in UCSR0A is set. RW 1 RXEN0 Receiver Enable Writing this bit to one enables the USART receiver. The receiver will override normal port operation for the RxD pin when enabled. Disabling the receiver will flush the receive buffer invalidating the FE, DOR and PE flags. RW 0 TXEN0 Transmitter Enable Writing this bit to one enables the USART transmitter. The transmitter will override normal port operation for the TxD pin when enabled. The disabling of the transmitter (writing TXEN to zero) will not become effective until ongoing and pending transmissions are completed, i.e. when the transmit shift register and transmit buffer register does not contain data to be transmitted. When disabled, the transmitter will no longer override the TxD port. RW 0 UCSZ02 Character Size The UCSZ2 bits combined with the UCSZ1:0 bit in UCSR0C sets the number of data bits (character size) in a frame the receiver and transmitter use. RW 0 RXB80 Receive Data Bit 8 RXB8 is the 9th data bit of the received character when operating with serial frames with 9 data bits. Must be read before reading the low bits from UDR0. R 0 TXB80 Transmit Data Bit 8 TXB8 is the 9th data bit in the character to be transmitted when operating with serial frames with 9 data bits. Must be writ-ten before writing the low bits to UDR0. W 0 UCSR0C USART Control and Status Register C NA $C2 io_flag.bmp Y UMSEL01 UMSEL1 USART Mode Select RW 0 UMSEL00 UMSEL0 USART Mode Select RW 0 UPM01 Parity Mode Bit 1 This bit enable and set type of parity generation and check. If enabled, the transmitter will automatically generate and send the parity of the transmitted data bits within each frame. The receiver will generate a parity value for the incoming data and compare it to the UPM0 setting. If a mismatch is detected, the PE flag in UCSR0A will be set. RW 0 UPM00 Parity Mode Bit 0 This bit enable and set type of parity generation and check. If enabled, the transmitter will automatically generate and send the parity of the transmitted data bits within each frame. The receiver will generate a parity value for the incoming data and compare it to the UPM0 setting. If a mismatch is detected, the PE flag in UCSR0A will be set. RW 0 USBS0 Stop Bit Select 0: 1-bit. 1: 2-bit. RW 0 UCSZ01 UDORD0 Character Size Character Size: 0 0 0 = 5-bit. 0 0 1 = 6-bit. 0 1 0 = 7 bit. 0 1 1 = 8-bit. 1 1 1 = 9 bit. RW 0 UCSZ00 UCPHA0 Character Size Character Size: 0 0 0 = 5-bit. 0 0 1 = 6-bit. 0 1 0 = 7 bit. 0 1 1 = 8-bit. 1 1 1 = 9 bit. RW 1 UCPOL0 Clock Polarity This bit is used for synchronous mode only. Write this bit to zero when asynchronous mode is used. The UCPOL bit sets the relationship between data output change and data input sample, and the synchronous clock (XCK). RW 0 UBRR0H USART Baud Rate Register High Byte This is a 12-bit register which contains the USART baud rate. The UBRR0H contains the 4 most significant bits, and the UBRR0L contains the 8 least significant bits of the USART baud rate. Ongoing transmissions by the transmitter and receiver will be corrupted if the baud rate is changed. Writing UBRR0L will trigger an immediate update of the baud rate prescaler. NA $C5 io_com.bmp N UBRR11 USART Baud Rate Register bit 11 RW 0 UBRR10 USART Baud Rate Register bit 10 RW 0 UBRR9 USART Baud Rate Register bit 9 RW 0 UBRR8 USART Baud Rate Register bit 8 RW 0 UBRR0L USART Baud Rate Register Low Byte This is a 12-bit register which contains the USART baud rate. The UBRR0H contains the 4 most significant bits, and the UBRR0L contains the 8 least significant bits of the USART baud rate. Ongoing transmissions by the transmitter and receiver will be corrupted if the baud rate is changed. Writing UBRR0L will trigger an immediate update of the baud rate prescaler. NA $C4 io_com.bmp N UBRR7 USART Baud Rate Register bit 7 RW 0 UBRR6 USART Baud Rate Register bit 6 RW 0 UBRR5 USART Baud Rate Register bit 5 RW 0 UBRR4 USART Baud Rate Register bit 4 RW 0 UBRR3 USART Baud Rate Register bit 3 RW 0 UBRR2 USART Baud Rate Register bit 2 RW 0 UBRR1 USART Baud Rate Register bit 1 RW 0 UBRR0 USART Baud Rate Register bit 0 RW 0 [TWAMR:TWBR:TWCR:TWSR:TWDR:TWAR] io_com.bmp TWI: Simple yet powerful and flexible communications interface, only two bus lines needed. Both master and slave operation supported. Device can operate as transmitter or receiver. 7-bit address space allows up to 128 different slave addresses. Multi-master arbitration support Up to 400 kHz data transfer speed Slew-rate limited output drivers Noise suppression circuitry rejects spikes on bus lines Fully programmable slave address with general call support Address recognition causes wake-up when AVR is in sleep mode The Two-Wire Serial Interface (TWI) is ideally suited to typical microcontroller applications. The TWI protocol allows the systems designer to interconnect up to 128 different devices using only two bidirectional bus lines, one for clock (SCL) andone for data (SDA). The only external hardware needed to implement the bus is a single pull-up resistor for each of the TWI bus lines. All devices connected to the bus have individual addresses, and mechanisms for resolving bus contention are inherent in the TWI pr TWAMR TWI (Slave) Address Mask Register The TWAMR can be loaded with a 7-bit Salve Address mask. Each of the bits in TWAMR can mask (disable) the corresponding address bits in the TWI Address Register (TWAR). If the mask bit is set to one then the address match logic ingnores the compare between the incomming address bit and the corresponding bit in TWAR. NA $BD io_com.bmp Y TWAM6 TWAMR6 RW 0 TWAM5 TWAMR5 RW 0 TWAM4 TWAMR4 RW 0 TWAM3 TWAMR3 RW 0 TWAM2 TWAMR2 RW 0 TWAM1 TWAMR1 RW 0 TWAM0 TWAMR0 RW 0 TWBR TWI Bit Rate register TWBR selects the division factor for the bit rate generator. The bit rate generator is a frequency divider which generates the SCL clock frequency in the master modes. See “Bit Rate Generator Unit” on page 165 for calculating bit rates. NA $B8 io_com.bmp N TWBR7 RW 0 TWBR6 RW 0 TWBR5 RW 0 TWBR4 RW 0 TWBR3 RW 0 TWBR2 RW 0 TWBR1 RW 0 TWBR0 RW 0 TWCR TWI Control Register The TWCR is used to control the operation of the TWI. It is used to enable the TWI, to initiate a master access by applying a START condition to the bus, to generate a receiver acknowledge, to generate a stop condition, and to control halting of the bus while the data to be written to the bus are written to the TWDR. It also indicates a write collision if data is attempted written to TWDR while the register is inaccessible. NA $BC io_flag.bmp Y TWINT TWI Interrupt Flag This bit is set by hardware when the TWI has finished its current job and expects application software response. If the I-bit in SREG and TWIE in TWCR are set, the MCU will jump to the TWI interrupt vector. While the TWINT flag is set, the SCL low period is stretched. The TWINT flag must be cleared by software by writing a logic one to it. Note that this flag is not automatically cleared by hardware when executing the interrupt routine. Also note that clearing this flag starts the operation of the TWI, so all accesses to the TWI Address Register (TWAR), TWI Status Register (TWSR), and TWI Data Register (TWDR) must be complete before clearing this flag RW 0 TWEA TWI Enable Acknowledge Bit The TWEA bit controls the generation of the acknowledge pulse. If the TWEA bit is written to one, the ACK pulse is gener-ated on the TWI bus if the following conditions are met: 1. The device’s own slave address has been received. 2. A general call has been received, while the TWGCE bit in the TWAR is set. 3. A data byte has been received in master receiver or slave receiver mode. By writing the TWEA bit to zero, the device can be virtually disconnected from the 2-wire Serial Bus temporarily. Address recognition can then be resumed by writing the TWEA bit to one again RW 0 TWSTA TWI Start Condition Bit The application writes the TWSTA bit to one when it desires to become a master on the 2-wire Serial Bus. The TWI hard-ware checks if the bus is available, and generates a START condition on the bus if it is free. However, if the bus is not free, the TWI waits until a STOP condition is detected, and then generates a new START condition to claim the bus Master sta-tus. TWSTA is cleared by the TWI hardware when the START condition has been transmitted. RW 0 TWSTO TWI Stop Condition Bit Writing the TWSTO bit to one in master mode will generate a STOP condition on the 2-wire Serial Bus. When the STOP condition is executed on the bus, the TWSTO bit is cleared automatically. In slave mode, setting the TWSTO bit can be used to recover from an error condition. This will not generate a STOP condition, but the TWI returns to a well-defined unaddressed slave mode and releases the SCL and SDA lines to a high impedance state. RW 0 TWWC TWI Write Collition Flag The TWWC bit is set when attempting to write to the TWI Data Register - TWDR when TWINT is low. This flag is cleared by writing the TWDR register when TWINT is high. RW 0 TWEN TWI Enable Bit The TWEN bit enables TWI operation and activates the TWI interface. When TWEN is written to one, the TWI takes control over the I/O pins connected to the SCL and SDA pins, enabling the slew-rate limiters and spike filters. If this bit is written to zero, the TWI is switched off and all TWI transmissions are terminated, regardless of any ongoing operation. RW 0 TWIE TWI Interrupt Enable When this bit is written to one, and the I-bit in SREG is set, the TWI interrupt request will be activated for as long as the TWINT flag is high. RW 0 TWSR TWI Status Register NA $B9 io_flag.bmp Y TWS7 TWI Status Bits 7..3: These 5 bits reflect the status of the TWI logic and the 2-Wire Serial Bus. The different status codes are described later in this chapter. Note that the value read from TWSR contains both the 5-bit status value and the 2-bit prescaler value. The application designer should consider masking the prescaler bits to zero when checking the Status bits. This makes status checking independent of prescaler setting. This approach is used in this datasheet, unless otherwise noted. If the prescaler setting remains unchanged in the application, the prescaler bits need not be masked. Instead, bit 1:0 in the values that TWSR is compared to can be modified to match the prescaler setting. This will yield more efficient c RW 0 TWS6 TWI Status Bits 7..3: These 5 bits reflect the status of the TWI logic and the 2-Wire Serial Bus. The different status codes are described later in this chapter. Note that the value read from TWSR contains both the 5-bit status value and the 2-bit prescaler value. The application designer should consider masking the prescaler bits to zero when checking the Status bits. This makes status checking independent of prescaler setting. This approach is used in this datasheet, unless otherwise noted. If the prescaler setting remains unchanged in the application, the prescaler bits need not be masked. Instead, bit 1:0 in the values that TWSR is compared to can be modified to match the prescaler setting. This will yield more efficient co RW 0 TWS5 TWI Status Bits 7..3: These 5 bits reflect the status of the TWI logic and the 2-Wire Serial Bus. The different status codes are described later in this chapter. Note that the value read from TWSR contains both the 5-bit status value and the 2-bit prescaler value. The application designer should consider masking the prescaler bits to zero when checking the Status bits. This makes status checking independent of prescaler setting. This approach is used in this datasheet, unless otherwise noted. If the prescaler setting remains unchanged in the application, the prescaler bits need not be masked. Instead, bit 1:0 in the values that TWSR is compared to can be modified to match the prescaler setting. This will yield more efficient c RW 0 TWS4 TWI Status Bits 7..3: These 5 bits reflect the status of the TWI logic and the 2-Wire Serial Bus. The different status codes are described later in this chapter. Note that the value read from TWSR contains both the 5-bit status value and the 2-bit prescaler value. The application designer should consider masking the prescaler bits to zero when checking the Status bits. This makes status checking independent of prescaler setting. This approach is used in this datasheet, unless otherwise noted. If the prescaler setting remains unchanged in the application, the prescaler bits need not be masked. Instead, bit 1:0 in the values that TWSR is compared to can be modified to match the prescaler setting. This will yield more efficient co RW 0 TWS3 TWI Status Bits 7..3: These 5 bits reflect the status of the TWI logic and the 2-Wire Serial Bus. The different status codes are described later in this chapter. Note that the value read from TWSR contains both the 5-bit status value and the 2-bit prescaler value. The application designer should consider masking the prescaler bits to zero when checking the Status bits. This makes status checking independent of prescaler setting. This approach is used in this datasheet, unless otherwise noted. If the prescaler setting remains unchanged in the application, the prescaler bits need not be masked. Instead, bit 1:0 in the values that TWSR is compared to can be modified to match the prescaler setting. This will yield more efficient co RW 0 TWPS1 TWI Prescaler Bits 1..0: These bits can be read and written, and control the bit rate prescaler. See “Bit Rate Generator Unit” on page 165 for calculating bit rates. RW 0 TWPS0 TWI Prescaler Bits 1..0: These bits can be read and written, and control the bit rate prescaler. See “Bit Rate Generator Unit” on page 165 for calculating bit rates. RW 0 TWDR TWI Data register In transmit mode, TWDR contains the next byte to be transmitted. In receive mode, the TWDR contains the last byte received. It is writable while the TWI is not in the process of shifting a byte. This occurs when the TWI interrupt flag (TWINT) is set by hardware. Note that the data register cannot be initialized by the user before the first interrupt occurs. The data in TWDR remains stable as long as TWINT is set. While data is shifted out, data on the bus is simultaneously shifted in. TWDR always contains the last byte present on the bus, except after a wake up from a sleep mode by the TWI interrupt. In this case, the contents of TWDR is undefined. In the case of a lost bus arbitration, no data is lost in the transi-tion from Master to Slave. Handling of the ACK bit is controlled automatically by the TWI logic, the CPU cannot access the ACK bit directl NA $BB io_com.bmp N TWD7 TWI Data Register Bit 7 RW 1 TWD6 TWI Data Register Bit 6 RW 1 TWD5 TWI Data Register Bit 5 RW 1 TWD4 TWI Data Register Bit 4 RW 1 TWD3 TWI Data Register Bit 3 RW 1 TWD2 TWI Data Register Bit 2 RW 1 TWD1 TWI Data Register Bit 1 RW 1 TWD0 TWI Data Register Bit 0 RW 1 TWAR TWI (Slave) Address register The TWAR should be loaded with the 7-bit slave address (in the seven most significant bits of TWAR) to which the TWI will respond when programmed as a slave transmitter or receiver, and not needed in the master modes. In multimaster sys-tems, TWAR must be set in masters which can be addressed as slaves by other masters. The LSB of TWAR is used to enable recognition of the general call address ($00). There is an associated address compar-ator that looks for the slave address (or general call address if enabled) in the received serial address. If a match is found, an interrupt request is genera NA $BA io_com.bmp Y TWA6 TWI (Slave) Address register Bit 6 RW 0 TWA5 TWI (Slave) Address register Bit 5 RW 0 TWA4 TWI (Slave) Address register Bit 4 RW 0 TWA3 TWI (Slave) Address register Bit 3 RW 0 TWA2 TWI (Slave) Address register Bit 2 RW 0 TWA1 TWI (Slave) Address register Bit 1 RW 0 TWA0 TWI (Slave) Address register Bit 0 RW 0 TWGCE TWI General Call Recognition Enable Bit RW 0 [SPDR:SPSR:SPCR] io_com.bmp The Serial Peripheral Interface(SPI) allows high-speed synchronous data transfer between the AT90S4414/8515 and peripheral devices or between several AVR devices. The AT90S4414/8515 SPI features include the following: • Full-duplex, 3-wire Synchronous Data Transfer • Master or Slave Operation • LSB First or MSB First Data Transfer • Four Programmable Bit Rates • End of Transmission Interrupt Flag • Write Collision Flag Protection • Wakeup from Idle Mode (Slave Mode Only) SPCR SPI Control Register $2C $4C io_flag.bmp Y SPIE SPI Interrupt Enable This bit causes the SPI interrupt to be executed if SPIF bit in the SPSR register is set and the global interrupts are enabled. RW 0 SPE SPI Enable When the SPE bit is set (one), the SPI is enabled. This bit must be set to enable any SPI operations. RW 0 DORD Data Order When the DORD bit is set (one), the LSB of the data word is transmitted first. When the DORD bit is cleared (zero), the MSB of the data word is transmitted first. RW 0 MSTR Master/Slave Select This bit selects Master SPI mode when set (one), and Slave SPI mode when cleared (zero). If SS is configured as an input and is driven low while MSTR is set, MSTR will be cleared, and SPIF in SPSR will become set. The user will then have to set MSTR to re-enable SPI master mode. RW 0 CPOL Clock polarity When this bit is set (one), SCK is high when idle. When CPOL is cleared (zero), SCK is low when idle. Refer to Figure 36 and Figure 37 for additional information. RW 0 CPHA Clock Phase Refer to Figure 36 or Figure 37 for the functionality of this bit. RW 0 SPR1 SPI Clock Rate Select 1 These two bits control the SCK rate of the device configured as a master. SPR1 and SPR0 have no effect on the slave. RW 0 SPR0 SPI Clock Rate Select 0 These two bits control the SCK rate of the device configured as a master. SPR1 and SPR0 have no effect on the slave. RW 0 SPSR SPI Status Register $2D $4D io_flag.bmp Y SPIF SPI Interrupt Flag When a serial transfer is complete, the SPIF bit is set (one) and an interrupt is generated if SPIE in SPCR is set (one) and global interrupts are enabled. If SS is an input and is driven low when the SPI is in master mode, this will also set the SPIF flag. SPIF is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, the SPIF bit is cleared by first reading the SPI status register when SPIF is set (one), then accessing the SPI Data Register (SPDR). R 0 WCOL Write Collision Flag The WCOL bit is set if the SPI data register (SPDR) is written during a data transfer. The WCOL bit (and the SPIF bit) are cleared (zero) by first reading the SPI Status Register when WCOL is set (one), and then accessing the SPI Data Register. R 0 SPI2X Double SPI Speed Bit When this bit is written logic one the SPI speed (SCK Frequency)will be doubled when the SPI is in master mode .This means that the minimum SCK period will be 2 CPU clock periods.When the SPI is configured as Slave,the SPI is only guaranteed to work at f osc /4orlower. The SPI interface on the ATmega162 is also used for program memory and EEPROM downloading or uploading. RW 0 SPDR SPI Data Register The SPI Data Register is a read/write register used for data transfer between the register file and the SPI Shift register. Writing to the register initiates data transmission. Reading the register causes the Shift Register Receive buffer to be read. $2E $4E io_com.bmp N SPDR7 SPI Data Register bit 7 RW X SPDR6 SPI Data Register bit 6 RW X SPDR5 SPI Data Register bit 5 RW X SPDR4 SPI Data Register bit 4 RW X SPDR3 SPI Data Register bit 3 RW X SPDR2 SPI Data Register bit 2 RW X SPDR1 SPI Data Register bit 1 R 0 SPDR0 SPI Data Register bit 0 R 0 [PORTA:DDRA:PINA] io_port.bmp AVRSimIOPort.SimIOPort PORTA Port A Data Register $02 $22 io_port.bmp N PORTA7 Port A Data Register bit 7 RW 0 PORTA6 Port A Data Register bit 6 RW 0 PORTA5 Port A Data Register bit 5 RW 0 PORTA4 Port A Data Register bit 4 RW 0 PORTA3 Port A Data Register bit 3 RW 0 PORTA2 Port A Data Register bit 2 RW 0 PORTA1 Port A Data Register bit 1 RW 0 PORTA0 Port A Data Register bit 0 RW 0 DDRA Port A Data Direction Register $01 $21 io_flag.bmp N DDA7 Data Direction Register, Port A, bit 7 RW 0 DDA6 Data Direction Register, Port A, bit 6 RW 0 DDA5 Data Direction Register, Port A, bit 5 RW 0 DDA4 Data Direction Register, Port A, bit 4 RW 0 DDA3 Data Direction Register, Port A, bit 3 RW 0 DDA2 Data Direction Register, Port A, bit 2 RW 0 DDA1 Data Direction Register, Port A, bit 1 RW 0 DDA0 Data Direction Register, Port A, bit 0 RW 0 PINA Port A Input Pins The Port A Input Pins address - PINA - is not a register, and this address enables access to the physical value on each Port A pin. When reading PORTA the Port A Data Latch is read, and when reading PINA, the logical values present on the pins are read. $00 $20 io_port.bmp N PINA7 Input Pins, Port A bit 7 RW Hi-Z PINA6 Input Pins, Port A bit 6 RW Hi-Z PINA5 Input Pins, Port A bit 5 RW Hi-Z PINA4 Input Pins, Port A bit 4 RW Hi-Z PINA3 Input Pins, Port A bit 3 RW Hi-Z PINA2 Input Pins, Port A bit 2 RW Hi-Z PINA1 Input Pins, Port A bit 1 RW Hi-Z PINA0 Input Pins, Port A bit 0 RW Hi-Z [PORTB:DDRB:PINB] io_port.bmp AVRSimIOPort.SimIOPort PORTB Port B Data Register $05 $25 io_port.bmp N PORTB7 Port B Data Register bit 7 RW 0 PORTB6 Port B Data Register bit 6 RW 0 PORTB5 Port B Data Register bit 5 RW 0 PORTB4 Port B Data Register bit 4 RW 0 PORTB3 Port B Data Register bit 3 RW 0 PORTB2 Port B Data Register bit 2 RW 0 PORTB1 Port B Data Register bit 1 RW 0 PORTB0 Port B Data Register bit 0 RW 0 DDRB Port B Data Direction Register $04 $24 io_flag.bmp N DDB7 Port B Data Direction Register bit 7 RW 0 DDB6 Port B Data Direction Register bit 6 RW 0 DDB5 Port B Data Direction Register bit 5 RW 0 DDB4 Port B Data Direction Register bit 4 RW 0 DDB3 Port B Data Direction Register bit 3 RW 0 DDB2 Port B Data Direction Register bit 2 RW 0 DDB1 Port B Data Direction Register bit 1 RW 0 DDB0 Port B Data Direction Register bit 0 RW 0 PINB Port B Input Pins The Port B Input Pins address - PINB - is not a register, and this address enables access to the physical value on each Port B pin. When reading PORTB, the Port B Data Latch is read, and when reading PINB, the logical values present on the pins are read. $03 $23 io_port.bmp N PINB7 Port B Input Pins bit 7 R 0 PINB6 Port B Input Pins bit 6 R 0 PINB5 Port B Input Pins bit 5 R 0 PINB4 Port B Input Pins bit 4 R 0 PINB3 Port B Input Pins bit 3 R 0 PINB2 Port B Input Pins bit 2 R 0 PINB1 Port B Input Pins bit 1 R 0 PINB0 Port B Input Pins bit 0 R 0 [PORTC:DDRC:PINC] io_port.bmp AVRSimIOPort.SimIOPort PORTC Port C Data Register $08 $28 io_port.bmp N PORTC7 Port C Data Register bit 7 RW 0 PORTC6 Port C Data Register bit 6 RW 0 PORTC5 Port C Data Register bit 5 RW 0 PORTC4 Port C Data Register bit 4 RW 0 PORTC3 Port C Data Register bit 3 RW 0 PORTC2 Port C Data Register bit 2 RW 0 PORTC1 Port C Data Register bit 1 RW 0 PORTC0 Port C Data Register bit 0 RW 0 DDRC Port C Data Direction Register $07 $27 io_flag.bmp N DDC7 Port C Data Direction Register bit 7 RW 0 DDC6 Port C Data Direction Register bit 6 RW 0 DDC5 Port C Data Direction Register bit 5 RW 0 DDC4 Port C Data Direction Register bit 4 RW 0 DDC3 Port C Data Direction Register bit 3 RW 0 DDC2 Port C Data Direction Register bit 2 RW 0 DDC1 Port C Data Direction Register bit 1 RW 0 DDC0 Port C Data Direction Register bit 0 RW 0 PINC Port C Input Pins The Port C Input Pins address - PINC - is not a register, and this address enables access to the physical value on each Port C pin. When reading PORTC, the Port C Data Latch is read, and when reading PINC, the logical values present on the pins are read. $06 $26 io_port.bmp N PINC7 Port C Input Pins bit 7 R 0 PINC6 Port C Input Pins bit 6 R 0 PINC5 Port C Input Pins bit 5 R 0 PINC4 Port C Input Pins bit 4 R 0 PINC3 Port C Input Pins bit 3 R 0 PINC2 Port C Input Pins bit 2 R 0 PINC1 Port C Input Pins bit 1 R 0 PINC0 Port C Input Pins bit 0 R 0 [PORTD:DDRD:PIND] io_port.bmp AVRSimIOPort.SimIOPort PORTD Port D Data Register $0B $2B io_port.bmp N PORTD7 Port D Data Register bit 7 RW 0 PORTD6 Port D Data Register bit 6 RW 0 PORTD5 Port D Data Register bit 5 RW 0 PORTD4 Port D Data Register bit 4 RW 0 PORTD3 Port D Data Register bit 3 RW 0 PORTD2 Port D Data Register bit 2 RW 0 PORTD1 Port D Data Register bit 1 RW 0 PORTD0 Port D Data Register bit 0 RW 0 DDRD Port D Data Direction Register $0A $2A io_flag.bmp N DDD7 Port D Data Direction Register bit 7 RW 0 DDD6 Port D Data Direction Register bit 6 RW 0 DDD5 Port D Data Direction Register bit 5 RW 0 DDD4 Port D Data Direction Register bit 4 RW 0 DDD3 Port D Data Direction Register bit 3 RW 0 DDD2 Port D Data Direction Register bit 2 RW 0 DDD1 Port D Data Direction Register bit 1 RW 0 DDD0 Port D Data Direction Register bit 0 RW 0 PIND Port D Input Pins The Port D Input Pins address - PIND - is not a register, and this address enables access to the physical value on each Port D pin. When reading PORTD, the Port D Data Latch is read, and when reading PIND, the logical values present on the pins are read. $09 $29 io_port.bmp N PIND7 Port D Input Pins bit 7 R 0 PIND6 Port D Input Pins bit 6 R 0 PIND5 Port D Input Pins bit 5 R 0 PIND4 Port D Input Pins bit 4 R 0 PIND3 Port D Input Pins bit 3 R 0 PIND2 Port D Input Pins bit 2 R 0 PIND1 Port D Input Pins bit 1 R 0 PIND0 Port D Input Pins bit 0 R 0 [PORTE:DDRE:PINE] io_port.bmp AVRSimIOPort.SimIOPort PORTE Data Register, Port E $0E $2E io_port.bmp N PORTE7 RW 0 PORTE6 RW 0 PORTE5 RW 0 PORTE4 RW 0 PORTE3 RW 0 PORTE2 RW 0 PORTE1 RW 0 PORTE0 RW 0 DDRE Data Direction Register, Port E $0D $2D io_flag.bmp N DDE7 RW 0 DDE6 RW 0 DDE5 RW 0 DDE4 RW 0 DDE3 RW 0 DDE2 RW 0 DDE1 RW 0 DDE0 RW 0 PINE Input Pins, Port E $0C $2C io_port.bmp N PINE7 R 0 PINE6 R 0 PINE5 R 0 PINE4 R 0 PINE3 R 0 PINE2 R 0 PINE1 R 0 PINE0 R 0 [PORTF:DDRF:PINF] io_port.bmp AVRSimIOPort.SimIOPort PORTF Data Register, Port F $11 $31 io_port.bmp N PORTF7 RW 0 PORTF6 RW 0 PORTF5 RW 0 PORTF4 RW 0 PORTF3 RW 0 PORTF2 RW 0 PORTF1 RW 0 PORTF0 RW 0 DDRF Data Direction Register, Port F $10 $30 io_flag.bmp N DDF7 RW 0 DDF6 RW 0 DDF5 RW 0 DDF4 RW 0 DDF3 RW 0 DDF2 RW 0 DDF1 RW 0 DDF0 RW 0 PINF Input Pins, Port F $0F $2F io_port.bmp N PINF7 R 0 PINF6 R 0 PINF5 R 0 PINF4 R 0 PINF3 R 0 PINF2 R 0 PINF1 R 0 PINF0 R 0 [PORTG:DDRG:PING] io_port.bmp AVRSimIOPort.SimIOPort PORTG Data Register, Port G $14 $34 io_port.bmp N PORTG5 RW 0 PORTG4 RW 0 PORTG3 RW 0 PORTG2 RW 0 PORTG1 RW 0 PORTG0 RW 0 DDRG Data Direction Register, Port G $13 $33 io_flag.bmp N DDG5 RW 0 DDG4 RW 0 DDG3 RW 0 DDG2 RW 0 DDG1 RW 0 DDG0 RW 0 PING Input Pins, Port G $12 $32 io_port.bmp N PING5 R 0 PING4 R 0 PING3 R 0 PING2 R 0 PING1 R 0 PING0 R 0 [PORTH:DDRH:PINH] io_port.bmp AVRSimIOPort.SimIOPort PORTH PORT H Data Register NA $102 io_port.bmp N PORTH7 PORT H Data Register bit 7 RW 0 PORTH6 PORT H Data Register bit 6 RW 0 PORTH5 PORT H Data Register bit 5 RW 0 PORTH4 PORT H Data Register bit 4 RW 0 PORTH3 PORT H Data Register bit 3 RW 0 PORTH2 PORT H Data Register bit 2 RW 0 PORTH1 PORT H Data Register bit 1 RW 0 PORTH0 PORT H Data Register bit 0 RW 0 DDRH PORT H Data Direction Register NA $101 io_flag.bmp N DDH7 PORT H Data Direction Register bit 7 RW 0 DDH6 PORT H Data Direction Register bit 6 RW 0 DDH5 PORT H Data Direction Register bit 5 RW 0 DDH4 PORT H Data Direction Register bit 4 RW 0 DDH3 PORT H Data Direction Register bit 3 RW 0 DDH2 PORT H Data Direction Register bit 2 RW 0 DDH1 PORT H Data Direction Register bit 1 RW 0 DDH0 PORT H Data Direction Register bit 0 RW 0 PINH PORT H Input Pins The PORT H Input Pins address - PINH - is not a register, and this address enables access to the physical value on each PORT H pin. When reading PORTH, the PORT H Data Latch is read, and when reading PINH, the logical values present on the pins are read. NA $100 io_port.bmp N PINH7 PORT H Input Pins bit 7 R 0 PINH6 PORT H Input Pins bit 6 R 0 PINH5 PORT H Input Pins bit 5 R 0 PINH4 PORT H Input Pins bit 4 R 0 PINH3 PORT H Input Pins bit 3 R 0 PINH2 PORT H Input Pins bit 2 R 0 PINH1 PORT H Input Pins bit 1 R 0 PINH0 PORT H Input Pins bit 0 R 0 [PORTJ:DDRJ:PINJ] io_port.bmp AVRSimIOPort.SimIOPort PORTJ PORT J Data Register NA $105 io_port.bmp N PORTJ7 PORT J Data Register bit 7 RW 0 PORTJ6 PORT J Data Register bit 6 RW 0 PORTJ5 PORT J Data Register bit 5 RW 0 PORTJ4 PORT J Data Register bit 4 RW 0 PORTJ3 PORT J Data Register bit 3 RW 0 PORTJ2 PORT J Data Register bit 2 RW 0 PORTJ1 PORT J Data Register bit 1 RW 0 PORTJ0 PORT J Data Register bit 0 RW 0 DDRJ PORT J Data Direction Register NA $104 io_flag.bmp N DDJ7 PORT J Data Direction Register bit 7 RW 0 DDJ6 PORT J Data Direction Register bit 6 RW 0 DDJ5 PORT J Data Direction Register bit 5 RW 0 DDJ4 PORT J Data Direction Register bit 4 RW 0 DDJ3 PORT J Data Direction Register bit 3 RW 0 DDJ2 PORT J Data Direction Register bit 2 RW 0 DDJ1 PORT J Data Direction Register bit 1 RW 0 DDJ0 PORT J Data Direction Register bit 0 RW 0 PINJ PORT J Input Pins The PORT J Input Pins address - PINJ - is not a register, and this address enables access to the physical value on each PORT J pin. When reading PORTJ, the PORT J Data Latch is read, and when reading PINJ, the logical values present on the pins are read. NA $103 io_port.bmp N PINJ7 PORT J Input Pins bit 7 R 0 PINJ6 PORT J Input Pins bit 6 R 0 PINJ5 PORT J Input Pins bit 5 R 0 PINJ4 PORT J Input Pins bit 4 R 0 PINJ3 PORT J Input Pins bit 3 R 0 PINJ2 PORT J Input Pins bit 2 R 0 PINJ1 PORT J Input Pins bit 1 R 0 PINJ0 PORT J Input Pins bit 0 R 0 [PORTK:DDRK:PINK] io_port.bmp AVRSimIOPort.SimIOPort PORTK PORT K Data Register NA $108 io_port.bmp N PORTK7 PORT K Data Register bit 7 RW 0 PORTK6 PORT K Data Register bit 6 RW 0 PORTK5 PORT K Data Register bit 5 RW 0 PORTK4 PORT K Data Register bit 4 RW 0 PORTK3 PORT K Data Register bit 3 RW 0 PORTK2 PORT K Data Register bit 2 RW 0 PORTK1 PORT K Data Register bit 1 RW 0 PORTK0 PORT K Data Register bit 0 RW 0 DDRK PORT K Data Direction Register NA $107 io_flag.bmp N DDK7 PORT K Data Direction Register bit 7 RW 0 DDK6 PORT K Data Direction Register bit 6 RW 0 DDK5 PORT K Data Direction Register bit 5 RW 0 DDK4 PORT K Data Direction Register bit 4 RW 0 DDK3 PORT K Data Direction Register bit 3 RW 0 DDK2 PORT K Data Direction Register bit 2 RW 0 DDK1 PORT K Data Direction Register bit 1 RW 0 DDK0 PORT K Data Direction Register bit 0 RW 0 PINK PORT K Input Pins The PORT K Input Pins address - PINK - is not a register, and this address enables access to the physical value on each PORT K pin. When reading PORTK, the PORT K Data Latch is read, and when reading PINK, the logical values present on the pins are read. NA $106 io_port.bmp N PINK7 PORT K Input Pins bit 7 R 0 PINK6 PORT K Input Pins bit 6 R 0 PINK5 PORT K Input Pins bit 5 R 0 PINK4 PORT K Input Pins bit 4 R 0 PINK3 PORT K Input Pins bit 3 R 0 PINK2 PORT K Input Pins bit 2 R 0 PINK1 PORT K Input Pins bit 1 R 0 PINK0 PORT K Input Pins bit 0 R 0 [PORTL:DDRL:PINL] io_port.bmp AVRSimIOPort.SimIOPort PORTL PORT L Data Register NA $10B io_port.bmp N PORTL7 PORT L Data Register bit 7 RW 0 PORTL6 PORT L Data Register bit 6 RW 0 PORTL5 PORT L Data Register bit 5 RW 0 PORTL4 PORT L Data Register bit 4 RW 0 PORTL3 PORT L Data Register bit 3 RW 0 PORTL2 PORT L Data Register bit 2 RW 0 PORTL1 PORT L Data Register bit 1 RW 0 PORTL0 PORT L Data Register bit 0 RW 0 DDRL PORT L Data Direction Register NA $10A io_flag.bmp N DDL7 PORT L Data Direction Register bit 7 RW 0 DDL6 PORT L Data Direction Register bit 6 RW 0 DDL5 PORT L Data Direction Register bit 5 RW 0 DDL4 PORT L Data Direction Register bit 4 RW 0 DDL3 PORT L Data Direction Register bit 3 RW 0 DDL2 PORT L Data Direction Register bit 2 RW 0 DDL1 PORT L Data Direction Register bit 1 RW 0 DDL0 PORT L Data Direction Register bit 0 RW 0 PINL PORT L Input Pins The PORT L Input Pins address - PINL - is not a register, and this address enables access to the physical value on each PORT L pin. When reading PORTL, the PORT L Data Latch is read, and when reading PINL, the logical values present on the pins are read. NA $109 io_port.bmp N PINL7 PORT L Input Pins bit 7 R 0 PINL6 PORT L Input Pins bit 6 R 0 PINL5 PORT L Input Pins bit 5 R 0 PINL4 PORT L Input Pins bit 4 R 0 PINL3 PORT L Input Pins bit 3 R 0 PINL2 PORT L Input Pins bit 2 R 0 PINL1 PORT L Input Pins bit 1 R 0 PINL0 PORT L Input Pins bit 0 R 0 [TIMSK0:TIFR0:TCCR0A:TCCR0B:TCNT0:OCR0A:OCR0B:GTCCR] io_timer.bmp At8pwm0_01 OCR0B Timer/Counter0 Output Compare Register The Output Compare Register contains an 8-bit value that is continuously compared with the counter value (TCNT0). A match can be used to generate an output compare interrupt, or to generate a waveform output on the OC0 pin. $28 $48 io_timer.bmp N OCR0B_7 RW 0 OCR0B_6 RW 0 OCR0B_5 RW 0 OCR0B_4 RW 0 OCR0B_3 RW 0 OCR0B_2 RW 0 OCR0B_1 RW 0 OCR0B_0 RW 0 OCR0A Timer/Counter0 Output Compare Register The Output Compare Register contains an 8-bit value that is continuously compared with the counter value (TCNT0). A match can be used to generate an output compare interrupt, or to generate a waveform output on the OC0 pin. $27 $47 io_timer.bmp N OCROA_7 RW 0 OCROA_6 RW 0 OCROA_5 RW 0 OCROA_4 RW 0 OCROA_3 RW 0 OCROA_2 RW 0 OCROA_1 RW 0 OCROA_0 RW 0 TCNT0 Timer/Counter0 The Timer/Counter Register gives direct access, both for read and write operations, to the Timer/Counter unit 8-bit counter. Writing to the TCNT0 register blocks (removes) the compare match on the following timer clock. Modifying the counter (TCNT0) while the counter is running, introduces a risk of missing a compare match between TCNT0 the OCR0 register. $26 $46 io_timer.bmp N TCNT0_7 RW 0 TCNT0_6 RW 0 TCNT0_5 RW 0 TCNT0_4 RW 0 TCNT0_3 RW 0 TCNT0_2 RW 0 TCNT0_1 RW 0 TCNT0_0 RW 0 TCCR0B Timer/Counter Control Register B $25 $45 io_flag.bmp Y FOC0A Force Output Compare A W 0 FOC0B Force Output Compare B W 0 WGM02 RW 0 CS02 Clock Select RW 0 CS01 Clock Select RW 0 CS00 Clock Select RW 0 TCCR0A Timer/Counter Control Register A $24 $44 io_flag.bmp Y COM0A1 Compare Output Mode, Phase Correct PWM Mode RW 0 COM0A0 Compare Output Mode, Phase Correct PWM Mode RW 0 COM0B1 Compare Output Mode, Fast PWm W 0 COM0B0 Compare Output Mode, Fast PWm RW 0 WGM01 Waveform Generation Mode RW 0 WGM00 Waveform Generation Mode RW 0 TIMSK0 Timer/Counter0 Interrupt Mask Register NA $6E io_flag.bmp Y OCIE0B Timer/Counter0 Output Compare Match B Interrupt Enable RW 0 OCIE0A Timer/Counter0 Output Compare Match A Interrupt Enable RW 0 TOIE0 Timer/Counter0 Overflow Interrupt Enable RW 0 TIFR0 Timer/Counter0 Interrupt Flag register $15 $35 io_flag.bmp Y OCF0B Timer/Counter0 Output Compare Flag 0B RW 0 OCF0A Timer/Counter0 Output Compare Flag 0A RW 0 TOV0 Timer/Counter0 Overflow Flag RW 0 GTCCR General Timer/Counter Control Register $23 $43 io_flag.bmp Y TSM Timer/Counter Synchronization Mode Writing the TSM bit to one activates the Timer/Counter Synchronization mode. In this mode, the value that is written to the PSR2 and PSR10 bits is kept, hence keeping the corresponding prescaler reset signals asserted. This ensures that the corresponding Timer/Counters are halted and can be configured to the same value without the risk of one of them advancing during configuration. When the TSM bit is written to zero, the PSR2 and PSR10 bits are cleared by hardware, and the Timer/Counters start counting simultaneousl RW 0 PSRSYNC PSR10 Prescaler Reset Timer/Counter1 and Timer/Counter0 When this bit is one, Timer/Counter1 and Timer/Counter0 prescaler will be Reset. This bit is normally cleared immediately by hardware, except if the TSM bit is set. Note that Timer/Counter1 and Timer/Counter0 share the same prescaler and a reset of this prescaler will affect both timers. RW 0 [TIMSK2:TIFR2:TCCR2A:TCCR2B:TCNT2:OCR2A:OCR2B:ASSR:GTCCR] io_timer.bmp At8pwm2_07 The 8-bit Timer/Counter2 can select clock source from CK, prescaled CK, or external crystal input TOSC1. It can also be stopped as described in the section “Timer/Counter2 Control Register - TCCR2”. The status flags (overflow and compare match) are found in the Timer/Counter Interrupt Flag Register - TIFR. Control signals are found in the Timer/Counter Control Register TCCR2. The interrupt enable/disable settings are found in “The Timer/Counter Interrupt Mask Register - TIMSK”. When Timer/Counter2 is externally clocked, the external signal is synchronized with the oscillator frequency of the CPU. To assure proper sampling of the external clock, the minimum time between two external clock transitions must be at least one internal CPU clock period. The external clock signal is sampled on the rising edge of the internal CPU clock. This module features a high resolution and a high accuracy usage with the lower prescaling opportunities. Similarly, the high prescaling opportunities make this unit useful for lower speed functions or exact timing functions with infrequent actions. Timer/Counter2 can also be used as an 8-bit Pulse Width Modulator. In this mode, Timer/Counter2 and the output compare register serve as a glitch-free, stand-alone PWM with centered puls TIMSK2 Timer/Counter Interrupt Mask register NA $70 io_flag.bmp Y OCIE2B Timer/Counter2 Output Compare Match B Interrupt Enable When the OCIE2B bit is written to one and the I-bit in the Status Register is set (one), the Timer/Counter2 Compare Match B interrupt is enabled. The corresponding interrupt is executed if a compare match in Timer/Counter2 occurs, i.e., when the OCF2B bit is set in the Timer/Counter 2 Interrupt Flag Register – TIFR2. RW 0 OCIE2A Timer/Counter2 Output Compare Match A Interrupt Enable When the OCIE2A bit is written to one and the I-bit in the Status Register is set (one), the Timer/Counter2 Compare Match A interrupt is enabled. The corresponding interrupt is executed if a compare match in Timer/Counter2 occurs, i.e., when the OCF2A bit is set in the Timer/Counter 2 Interrupt Flag Register – TIFR2. RW 0 TOIE2 TOIE2A Timer/Counter2 Overflow Interrupt Enable When the TOIE2 bit is written to one and the I-bit in the Status Register is set (one), the Timer/Counter2 Overflow interrupt is enabled. The corresponding interrupt is executed if an overflow in Timer/Counter2 occurs, i.e., when the TOV2 bit is set in the Timer/Counter2 Interrupt Flag Register – TIFR2. RW 0 TIFR2 Timer/Counter Interrupt Flag Register $17 $37 io_flag.bmp Y OCF2B Output Compare Flag 2B The OCF2B bit is set (one) when a compare match occurs between the Timer/Counter2 and the data in OCR2B – Output Compare Register2. OCF2B is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, OCF2B is cleared by writing a logic one to the flag. When the I-bit in SREG, OCIE2B (Timer/Counter2 Compare match Interrupt Enable), and OCF2B are set (one), the Timer/Counter2 Compare match Interrupt is executed. RW 0 OCF2A Output Compare Flag 2A The OCF2A bit is set (one) when a compare match occurs between the Timer/Counter2 and the data in OCR2A – Output Compare Register2. OCF2A is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, OCF2A is cleared by writing a logic one to the flag. When the I-bit in SREG, OCIE2A (Timer/Counter2 Compare match Interrupt Enable), and OCF2A are set (one), the Timer/Counter2 Compare match Interrupt is executed. RW 0 TOV2 Timer/Counter2 Overflow Flag The TOV2 bit is set (one) when an overflow occurs in Timer/Counter2. TOV2 is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, TOV2 is cleared by writing a logic one to the flag. When the SREG I-bit, TOIE2A (Timer/Counter2 Overflow Interrupt Enable), and TOV2 are set (one), the Timer/Counter2 Overflow interrupt is executed. In PWM mode, this bit is set when Timer/Counter2 changes counting direction at 0x00. RW 0 TCCR2A Timer/Counter2 Control Register A NA $B0 io_flag.bmp Y COM2A1 Compare Output Mode bit 1 The COM21 and COM20 control bits determine any output pin action following a compare match in Timer/Counter2. Output pin actions affect pin PD7(OC2). This is an alternative function to an I/O port, and the corresponding direction control bit must be set (one) to control an output pin. (COM21:COM20) description: (0:0) = Timer/Counter disconnected from output pin OC2. (0:1) = Toggle the OC2 output line. (1:0) = Clear the OC2 output line (to zero). (1:1) = Set the OC2 output line (to one). Note: In PWM mode, these bits have a different function RW 0 COM2A0 Compare Output Mode bit 1 The COM21 and COM20 control bits determine any output pin action following a compare match in Timer/Counter2. Output pin actions affect pin PD7(OC2). This is an alternative function to an I/O port, and the corresponding direction control bit must be set (one) to control an output pin. (COM21:COM20) description: (0:0) = Timer/Counter disconnected from output pin OC2. (0:1) = Toggle the OC2 output line. (1:0) = Clear the OC2 output line (to zero). (1:1) = Set the OC2 output line (to one). Note: In PWM mode, these bits have a different function RW 0 COM2B1 Compare Output Mode bit 1 The COM21 and COM20 control bits determine any output pin action following a compare match in Timer/Counter2. Output pin actions affect pin PD7(OC2). This is an alternative function to an I/O port, and the corresponding direction control bit must be set (one) to control an output pin. (COM21:COM20) description: (0:0) = Timer/Counter disconnected from output pin OC2. (0:1) = Toggle the OC2 output line. (1:0) = Clear the OC2 output line (to zero). (1:1) = Set the OC2 output line (to one). Note: In PWM mode, these bits have a different function RW 0 COM2B0 Compare Output Mode bit 0 The COM21 and COM20 control bits determine any output pin action following a compare match in Timer/Counter2. Output pin actions affect pin PD7(OC2). This is an alternative function to an I/O port, and the corresponding direction control bit must be set (one) to control an output pin. (COM21:COM20) description: (0:0) = Timer/Counter disconnected from output pin OC2. (0:1) = Toggle the OC2 output line. (1:0) = Clear the OC2 output line (to zero). (1:1) = Set the OC2 output line (to one). Note: In PWM mode, these bits have a different functio RW 0 WGM21 Waveform Genration Mode These bits control the counting sequence of the counter,the source for hte maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter), Clear Timer on Compare match (CTC)mode,and two types of Pulse Width Modulation (PWM)modes. Please refer to the manual for more information. RW 0 WGM20 Waveform Genration Mode These bits control the counting sequence of the counter,the source for hte maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter), Clear Timer on Compare match (CTC)mode,and two types of Pulse Width Modulation (PWM)modes. Please refer to the manual for more information. RW 0 TCCR2B Timer/Counter2 Control Register B NA $B1 io_flag.bmp Y FOC2A Force Output Compare A Writing a logical one to this bit, forces a change in the compare match output pin PD7 (OC2) according to the values already set in COM21 and COM20. If the COM21 and COM20 bits are written in the same cycle as FOC2, the new settings will not take effect until next compare match or forced output compare match occurs. The Force Output Compare bit can be used to change the output pin without waiting for a compare match in the timer. The automatic action programmed in COM21 and COM20 happens as if a Compare Match had occurred, but no interrupt is generated, and the Timer/Counter will not be cleared even if CTC2 is set. The corresponding I/O pin must be set as an output pin for the FOC2 bit to have effect on the pin. The FOC2 bit will always be read as zero. Setting the FOC2 bit has no effect in PWM mode RW 0 FOC2B Force Output Compare B Writing a logical one to this bit, forces a change in the compare match output pin PD7 (OC2) according to the values already set in COM21 and COM20. If the COM21 and COM20 bits are written in the same cycle as FOC2, the new settings will not take effect until next compare match or forced output compare match occurs. The Force Output Compare bit can be used to change the output pin without waiting for a compare match in the timer. The automatic action programmed in COM21 and COM20 happens as if a Compare Match had occurred, but no interrupt is generated, and the Timer/Counter will not be cleared even if CTC2 is set. The corresponding I/O pin must be set as an output pin for the FOC2 bit to have effect on the pin. The FOC2 bit will always be read as zero. Setting the FOC2 bit has no effect in PWM mode RW 0 WGM22 Waveform Generation Mode These bits control the counting sequence of the counter,the source for hte maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter), Clear Timer on Compare match (CTC)mode,and two types of Pulse Width Modulation (PWM)modes. Please refer to the manual for more information. RW 0 CS22 Clock Select bit 2 The Clock Select bits 2,1, and 0 define the prescaling source of Timer/Counter2. (CS22:CS21:CS20) Description. (0:0:0) Timer/Counter2 is stopped. (0:0:1) PCK2. (0:1:0) PCK2/8. (0:1:1) PCK2/32. (1:0:0) PCK2/64. (1:0:1) PCK2/128. (1:1:0) PCK2/256. (1:1:1) PCK2/1024. The Stop condition provides a Timer Enable/Disable function. The prescaled modes are scaled directly from the PCK2 clock. RW 0 CS21 Clock Select bit 1 The Clock Select bits 2,1, and 0 define the prescaling source of Timer/Counter2. (CS22:CS21:CS20) Description. (0:0:0) Timer/Counter2 is stopped. (0:0:1) PCK2. (0:1:0) PCK2/8. (0:1:1) PCK2/32. (1:0:0) PCK2/64. (1:0:1) PCK2/128. (1:1:0) PCK2/256. (1:1:1) PCK2/1024. The Stop condition provides a Timer Enable/Disable function. The prescaled modes are scaled directly from the PCK2 clock. RW 0 CS20 Clock Select bit 0 The Clock Select bits 2,1, and 0 define the prescaling source of Timer/Counter2. (CS22:CS21:CS20) Description. (0:0:0) Timer/Counter2 is stopped. (0:0:1) PCK2. (0:1:0) PCK2/8. (0:1:1) PCK2/32. (1:0:0) PCK2/64. (1:0:1) PCK2/128. (1:1:0) PCK2/256. (1:1:1) PCK2/1024. The Stop condition provides a Timer Enable/Disable function. The prescaled modes are scaled directly from the PCK2 clock. RW 0 TCNT2 Timer/Counter2 This 8-bit register contains the value of Timer/Counter2. Timer/Counters2 is implemented as an up or up/down (in PWM mode) counter with read and write access. If the Timer/Counter2iswritten to and a clocksourceisselected,it continues counting in the timer clock cycle following the write operation. NA $B2 io_timer.bmp N TCNT2-7 Timer/Counter 2 bit 7 RW 0 TCNT2-6 Timer/Counter 2 bit 6 RW 0 TCNT2-5 Timer/Counter 2 bit 5 RW 0 TCNT2-4 Timer/Counter 2 bit 4 RW 0 TCNT2-3 Timer/Counter 2 bit 3 RW 0 TCNT2-2 Timer/Counter 2 bit 2 RW 0 TCNT2-1 Timer/Counter 2 bit 1 RW 0 TCNT2-0 Timer/Counter 2 bit 0 RW 0 OCR2B Timer/Counter2 Output Compare Register B The output compare register is an 8-bit read/write register. The Timer/Counter Output Compare Register contains the data to be continuously compared with Timer/Counter2. Actions on compare matches are specified in TCCR2. A compare match does only occur if Timer/Counter2 counts to the OCR2 value. A software write that sets TCNT2 and OCR2 to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Timer/Counter2 in PWM Mode When PWM mode is selected, the Timer/Counter2 either wraps (overflows) when it reaches $FF or it acts as an up/down counter. If the up/down mode is selected, the Timer/Counter2 and the Output Compare Register - OCR2 form an 8-bit, free-running, glitch-free, and phase correct PWM with outputs on the PD7(OC2) pin. If the overflow mode is selected, the Timer/Counter2 and the Output Compare Register - OCR2 form an 8-bit, free-running, and glitch-free PWM, operating with twice the speed of the up/down counting mode. PWM Modes (Up/Down and Overflow). The two different PWM modes are selected by the CTC2 bit in the Timer/Counter Control Register - TCCR2. If CTC2 is cleared and PWM mode is selected, the Timer/Counter acts as an up/down counter, counting up from $00 to $FF, where it turns and counts down again to zero before the cycle is repeated. When the counter value matches the con-tents of the Output Compare Register, the PD7(OC2) pin is set or cleared according to the settings of the COM21/COM20 bits in the Timer/Counter Control Register TCCR2. If CTC2 is set and PWM mode is selected, the Timer/Counters will wrap and start counting from $00 after reaching $FF. The PD7(OC2) pin will be set or cleared according to the settings of COM21/COM20 on a Timer/Counter overflow or when the counter value matches the contents of the Output Compare Register. Note that in PWM mode, the value to be written to the Output Compare Register is first transferred to a temporary location, and then latched into OCR2 when the Timer/Counter reaches $FF. This prevents the occurrence of odd-length PWM pulses (glitches) in the event of an unsynchronized OCR2 write. (CTC2:COM21:COM20) Effect on Compare Pin Frequency: (0:0:0) = Not connected. (0:0:1) = Not connected. (0:1:0) = Cleared on compare match, up-counting. Set on compare match, down-counting (non-inverted PWM). f TCK0/2 /510. (0:1:1) = Cleared on compare match, down-counting. Set on compare match, up-counting (inverted PWM). f TCK0/2 /510. (1:0:0) = Not connected. (1:0:1) = Not connected. (1:1:0) = Cleared on compare match, set on overflow. f TCK0/2 /256. (1:1:1) = Set on compare match, cleared on overflow. f TCK0/ NA $B4 io_timer.bmp N OCR2-7 Timer/Counter2 Output Compare Register Bit 7 RW 0 OCR2-6 Timer/Counter2 Output Compare Register Bit 6 RW 0 OCR2-5 Timer/Counter2 Output Compare Register Bit 5 RW 0 OCR2-4 Timer/Counter2 Output Compare Register Bit 4 RW 0 OCR2-3 Timer/Counter2 Output Compare Register Bit 3 RW 0 OCR2-2 Timer/Counter2 Output Compare Register Bit 2 RW 0 OCR2-1 Timer/Counter2 Output Compare Register Bit 1 RW 0 OCR2-0 Timer/Counter2 Output Compare Register Bit 0 RW 0 OCR2A Timer/Counter2 Output Compare Register A The output compare register is an 8-bit read/write register. The Timer/Counter Output Compare Register contains the data to be continuously compared with Timer/Counter2. Actions on compare matches are specified in TCCR2. A compare match does only occur if Timer/Counter2 counts to the OCR2 value. A software write that sets TCNT2 and OCR2 to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Timer/Counter2 in PWM Mode When PWM mode is selected, the Timer/Counter2 either wraps (overflows) when it reaches $FF or it acts as an up/down counter. If the up/down mode is selected, the Timer/Counter2 and the Output Compare Register - OCR2 form an 8-bit, free-running, glitch-free, and phase correct PWM with outputs on the PD7(OC2) pin. If the overflow mode is selected, the Timer/Counter2 and the Output Compare Register - OCR2 form an 8-bit, free-running, and glitch-free PWM, operating with twice the speed of the up/down counting mode. PWM Modes (Up/Down and Overflow). The two different PWM modes are selected by the CTC2 bit in the Timer/Counter Control Register - TCCR2. If CTC2 is cleared and PWM mode is selected, the Timer/Counter acts as an up/down counter, counting up from $00 to $FF, where it turns and counts down again to zero before the cycle is repeated. When the counter value matches the con-tents of the Output Compare Register, the PD7(OC2) pin is set or cleared according to the settings of the COM21/COM20 bits in the Timer/Counter Control Register TCCR2. If CTC2 is set and PWM mode is selected, the Timer/Counters will wrap and start counting from $00 after reaching $FF. The PD7(OC2) pin will be set or cleared according to the settings of COM21/COM20 on a Timer/Counter overflow or when the counter value matches the contents of the Output Compare Register. Note that in PWM mode, the value to be written to the Output Compare Register is first transferred to a temporary location, and then latched into OCR2 when the Timer/Counter reaches $FF. This prevents the occurrence of odd-length PWM pulses (glitches) in the event of an unsynchronized OCR2 write. (CTC2:COM21:COM20) Effect on Compare Pin Frequency: (0:0:0) = Not connected. (0:0:1) = Not connected. (0:1:0) = Cleared on compare match, up-counting. Set on compare match, down-counting (non-inverted PWM). f TCK0/2 /510. (0:1:1) = Cleared on compare match, down-counting. Set on compare match, up-counting (inverted PWM). f TCK0/2 /510. (1:0:0) = Not connected. (1:0:1) = Not connected. (1:1:0) = Cleared on compare match, set on overflow. f TCK0/2 /256. (1:1:1) = Set on compare match, cleared on overflow. f TCK0/ NA $B3 io_timer.bmp N OCR2-7 Timer/Counter2 Output Compare Register Bit 7 RW 0 OCR2-6 Timer/Counter2 Output Compare Register Bit 6 RW 0 OCR2-5 Timer/Counter2 Output Compare Register Bit 5 RW 0 OCR2-4 Timer/Counter2 Output Compare Register Bit 4 RW 0 OCR2-3 Timer/Counter2 Output Compare Register Bit 3 RW 0 OCR2-2 Timer/Counter2 Output Compare Register Bit 2 RW 0 OCR2-1 Timer/Counter2 Output Compare Register Bit 1 RW 0 OCR2-0 Timer/Counter2 Output Compare Register Bit 0 RW 0 ASSR Asynchronous Status Register NA $B6 io_flag.bmp Y EXCLK Enable External Clock Input When EXCLK is written to one, and asynchronous clock is selected, the external clock input buffer is enabled and an external clock can be input on Timer Oscillator 1 (TOSC1) pin instead of a 32 kHz crystal. Writing to EXCLK should be done before asynchronous operation is selected. Note that the crystal Oscillator will only run when this bit is zero. RW 0 AS2 Asynchronous Timer/Counter2 When AS2 is written to zero, Timer/Counter2 is clocked from the I/O clock, clkI/O. When AS2 is written to one, Timer/Counter2 is clocked from a crystal Oscillator connected to the Timer Oscillator 1 (TOSC1) pin. When the value of AS2 is changed, the contents of TCNT2, OCR2A, OCR2B, TCCR2A and TCCR2B might be corrupted. RW 0 TCN2UB Timer/Counter2 Update Busy When Timer/Counter2 operates asynchronously and TCNT2 is written, this bit becomes set. When TCNT2 has been updated from the temporary storage register, this bit is cleared by hardware. A logical zero in this bit indicates that TCNT2 is ready to be updated with a new value. R 0 OCR2AUB Output Compare Register2 Update Busy When Timer/Counter2 operates asynchronously and OCR2A is written, this bit becomes set. When OCR2A has been updated from the temporary storage register, this bit is cleared by hardware. A logical zero in this bit indicates that OCR2A is ready to be updated with a new value. R 0 OCR2BUB Output Compare Register 2 Update Busy When Timer/Counter2 operates asynchronously and OCR2B is written, this bit becomes set. When OCR2B has been updated from the temporary storage register, this bit is cleared by hardware. A logical zero in this bit indicates that OCR2B is ready to be updated with a new value. R 0 TCR2AUB Timer/Counter Control Register2 Update Busy When Timer/Counter2 operates asynchronously and TCCR2A is written, this bit becomes set. When TCCR2A has been updated from the temporary storage register, this bit is cleared by hardware. A logical zero in this bit indicates that TCCR2A is ready to be updated with a new value. R 0 TCR2BUB Timer/Counter Control Register2 Update Busy When Timer/Counter2 operates asynchronously and TCCR2B is written, this bit becomes set. When TCCR2B has been updated from the temporary storage register, this bit is cleared by hardware. A logical zero in this bit indicates that TCCR2B is ready to be updated with a new value. R 0 GTCCR General Timer Counter Control register $23 $43 io_flag.bmp Y TSM Timer/Counter Synchronization Mode RW 0 PSRASY PSR2 Prescaler Reset Timer/Counter2 When this bit is one, the Timer/Counter2 prescaler will be reset. This bit is normally cleared immediately by hardware. If the bit is written when Timer/Counter2 is operating in asynchronous mode, the bit will remain one until the prescaler has been reset. The bit will not be cleared by hardware if the TSM bit is set. Refer to the description of the “Bit 7 – TSM: Timer/Counter Synchronization Mode” on page 107 for a description of the Timer/Counter Synchronization mode. RW 0 [WDTCSR] io_watch.bmp WDTCSR Watchdog Timer Control Register NA $60 io_flag.bmp Y WDIF Watchdog Timeout Interrupt Flag RW 0 WDIE Watchdog Timeout Interrupt Enable RW 0 WDP3 Watchdog Timer Prescaler Bit 3 RW 0 WDCE Watchdog Change Enable RW 0 WDE Watch Dog Enable When the WDE is set (one) the Watchdog Timer is enabled, and if the WDE is cleared (zero) the Watchdog Timer function is disabled. WDE can only be cleared if the WDTOE bit is set(one). To disable an enabled watchdog timer, the following procedure must be followed: 1. In the same operation, write a logical one to WDTOE and WDE. A logical one must be written to WDE even though it is set to one before the disable operation starts. 2. Within the next four clock cycles, write a logical 0 to WDE. This disables the watchdog RW 0 WDP2 Watch Dog Timer Prescaler bit 2 RW 0 WDP1 Watch Dog Timer Prescaler bit 1 RW 0 WDP0 Watch Dog Timer Prescaler bit 0 RW 0 [UDR1:UCSR1A:UCSR1B:UCSR1C:UBRR1H:UBRR1L] [UBRR1H:UBRR1L] io_com.bmp The Universal Synchronous and Asynchronous serial Receiver and Transmitter (USART) is a highly flexible serial communication device. The main features are: • Full Duplex Operation (Independent Serial Receive and Transmit Registers) • Asynchronous or Synchronous Operation • Master or Slave Clocked Synchronous Operation • High Resolution Baud Rate Generator • Supports Serial Frames with 5, 6, 7, 8 or 9 Data Bits and 1 or 2 Stop Bits • Odd or Even Parity Generation and Parity Check Supported by Hardware • Data OverRun Detection • Framing Error Detection • Noise Filtering Includes False Start Bit Detection and Digital Low Pass Filter • Three Separate Interrupts on TX Complete, TX Data Register Empty and RX Complete • Multi-processor Communication Mode • Double Speed Asynchronous Communica UDR1 USART I/O Data Register The UDR1 register is actually two physically separate registers sharing the same I/O address. When writing to the register, the USART Transmit Data register is written. When reading from UDR0, the USART Receive Data register is read. NA $CE io_com.bmp N UDR1-7 USART I/O Data Register bit 7 RW 0 UDR1-6 USART I/O Data Register bit 6 RW 0 UDR1-5 USART I/O Data Register bit 5 RW 0 UDR1-4 USART I/O Data Register bit 4 RW 0 UDR1-3 USART I/O Data Register bit 3 RW 0 UDR1-2 USART I/O Data Register bit 2 RW 0 UDR1-1 USART I/O Data Register bit 1 RW 0 UDR1-0 USART I/O Data Register bit 0 RW 0 UCSR1A USART Control and Status Register A NA $C8 io_flag.bmp Y RXC1 USART Receive Complete This bit is set (one) when a received character is transferred from the Receiver Shift register to UDR0. The bit is set regard-less of any detected framing errors. When the RXCIE bit in UCR is set, the USART Receive Complete interrupt will be executed when RXC is set(one). RXC is cleared by reading UDR0. When interrupt-driven data reception is used, the USART Receive Complete Interrupt routine must read UDRin order to clear RXC, otherwise a new interrupt will occur once the interrupt routine terminates. R 0 TXC1 USART Transmitt Complete This bit is set (one) when the entire character (including the stop bit) in the Transmit Shift register has been shifted out and no new data has been written to UDR0. This flag is especially useful in half-duplex communications interfaces, where a transmitting application must enter receive mode and free the communications bus immediately after completing the transmission. When the TXCIE bit in UCR is set, setting of TXC causes the USART Transmit Complete interrupt to be executed. TXC is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, the TXC bit is cleared (zero) by writing a logical one to the b RW 0 UDRE1 USART Data Register Empty This bit is set (one) when a character written to UDRis transferred to the Transmit shift register. Setting of this bit indicates that the transmitter is ready to receive a new character for transmission. When the UDR0IE bit in UCR is set, the USART Transmit Complete interrupt to be executed as long as UDR0E is set. UDR0E is cleared by writing UDR0. When interrupt-driven data transmittal is used, the USART Data Register Empty Interrupt routine must write UDRin order to clear UDR0E, otherwise a new interrupt will occur once the interrupt routine terminates. UDR0E is set (one) during reset to indicate that the transmitter is re R 1 FE1 Framing Error This bit is set if a Framing Error condition is detected, i.e. when the stop bit of an incoming character is zero. The FE bit is cleared when the stop bit of received data is one. R 0 DOR1 Data overRun This bit is set if an Overrun condition is detected, i.e. when a character already present in the UDRregister is not read before the next character has been shifted into the Receiver Shift register. The OR bit is buffered, which means that it will be set once the valid data still in UDR0E is read. The OR bit is cleared (zero) when data is received and transferred to UDR0. R 0 UPE1 Parity Error This bit is set if the next character in the receive buffer had a Parity Error when received and the parity checking was enabled at that point (UPM1 = 1). This bit is valid until the receive buffer (UDR0) is read. Always set this bit to zero when writing to UCSR0A. R 0 U2X1 Double the USART transmission speed This bit only has effect for the asynchronous operation. Write this bit to zero when using synchronous operation. Writing this bit to one will reduce the divisor of the baud rate divider from 16 to 8 effectively doubling the transfer rate for asynchronous communication. RW 0 MPCM1 Multi-processor Communication Mode This bit enables the Multi-processor Communication Mode. When the MPCM bit is written to one, all the incoming frames received by the USART receiver that do not contain address information will be ignored. The transmitter is unaffected by the MPCM setting. For more detailed information see “Multi-processor Communication Mode” on page 152. RW 0 UCSR1B USART Control and Status Register B NA $C9 io_flag.bmp Y RXCIE1 RX Complete Interrupt Enable Writing this bit to one enables interrupt on the RXC flag. A USART Receive Complete interrupt will be generated only if the RXCIE bit is written to one, the global interrupt flag in SREG is written to one and the RXC bit in UCSR0A is set. RW 0 TXCIE1 TX Complete Interrupt Enable Writing this bit to one enables interrupt on the TXC flag. A USART Transmit Complete interrupt will be generated only if the TXCIE bit is written to one, the global interrupt flag in SREG is written to one and the TXC bit in UCSR0A is set. RW 0 UDRIE1 USART Data register Empty Interrupt Enable Writing this bit to one enables interrupt on the UDR0E flag. A Data Register Empty interrupt will be generated only if the UDR0IE bit is written to one, the global interrupt flag in SREG is written to one and the UDR0E bit in UCSR0A is set. RW 1 RXEN1 Receiver Enable Writing this bit to one enables the USART receiver. The receiver will override normal port operation for the RxD pin when enabled. Disabling the receiver will flush the receive buffer invalidating the FE, DOR and PE flags. RW 0 TXEN1 Transmitter Enable Writing this bit to one enables the USART transmitter. The transmitter will override normal port operation for the TxD pin when enabled. The disabling of the transmitter (writing TXEN to zero) will not become effective until ongoing and pending transmissions are completed, i.e. when the transmit shift register and transmit buffer register does not contain data to be transmitted. When disabled, the transmitter will no longer override the TxD port. RW 0 UCSZ12 Character Size The UCSZ2 bits combined with the UCSZ1:0 bit in UCSR0C sets the number of data bits (character size) in a frame the receiver and transmitter use. RW 0 RXB81 Receive Data Bit 8 RXB8 is the 9th data bit of the received character when operating with serial frames with 9 data bits. Must be read before reading the low bits from UDR0. R 0 TXB81 Transmit Data Bit 8 TXB8 is the 9th data bit in the character to be transmitted when operating with serial frames with 9 data bits. Must be writ-ten before writing the low bits to UDR0. W 0 UCSR1C USART Control and Status Register C NA $CA io_flag.bmp Y UMSEL11 USART Mode Select RW 0 UMSEL10 USART Mode Select RW 0 UPM11 Parity Mode Bit 1 This bit enable and set type of parity generation and check. If enabled, the transmitter will automatically generate and send the parity of the transmitted data bits within each frame. The receiver will generate a parity value for the incoming data and compare it to the UPM0 setting. If a mismatch is detected, the PE flag in UCSR0A will be set. RW 0 UPM10 Parity Mode Bit 0 This bit enable and set type of parity generation and check. If enabled, the transmitter will automatically generate and send the parity of the transmitted data bits within each frame. The receiver will generate a parity value for the incoming data and compare it to the UPM0 setting. If a mismatch is detected, the PE flag in UCSR0A will be set. RW 0 USBS1 Stop Bit Select 0: 1-bit. 1: 2-bit. RW 0 UCSZ11 Character Size Character Size: 0 0 0 = 5-bit. 0 0 1 = 6-bit. 0 1 0 = 7 bit. 0 1 1 = 8-bit. 1 1 1 = 9 bit. RW 1 UCSZ10 Character Size Character Size: 0 0 0 = 5-bit. 0 0 1 = 6-bit. 0 1 0 = 7 bit. 0 1 1 = 8-bit. 1 1 1 = 9 bit. RW 1 UCPOL1 Clock Polarity This bit is used for synchronous mode only. Write this bit to zero when asynchronous mode is used. The UCPOL bit sets the relationship between data output change and data input sample, and the synchronous clock (XCK). RW 0 UBRR1H USART Baud Rate Register High Byte This is a 12-bit register which contains the USART baud rate. The UBRR0H contains the 4 most significant bits, and the UBRR0L contains the 8 least significant bits of the USART baud rate. Ongoing transmissions by the transmitter and receiver will be corrupted if the baud rate is changed. Writing UBRR0L will trigger an immediate update of the baud rate prescaler. NA $CD io_com.bmp N UBRR11 USART Baud Rate Register bit 11 RW 0 UBRR10 USART Baud Rate Register bit 10 RW 0 UBRR9 USART Baud Rate Register bit 9 RW 0 UBRR8 USART Baud Rate Register bit 8 RW 0 UBRR1L USART Baud Rate Register Low Byte This is a 12-bit register which contains the USART baud rate. The UBRR0H contains the 4 most significant bits, and the UBRR0L contains the 8 least significant bits of the USART baud rate. Ongoing transmissions by the transmitter and receiver will be corrupted if the baud rate is changed. Writing UBRR0L will trigger an immediate update of the baud rate prescaler. NA $CC io_com.bmp N UBRR7 USART Baud Rate Register bit 7 RW 0 UBRR6 USART Baud Rate Register bit 6 RW 0 UBRR5 USART Baud Rate Register bit 5 RW 0 UBRR4 USART Baud Rate Register bit 4 RW 0 UBRR3 USART Baud Rate Register bit 3 RW 0 UBRR2 USART Baud Rate Register bit 2 RW 0 UBRR1 USART Baud Rate Register bit 1 RW 0 UBRR0 USART Baud Rate Register bit 0 RW 0 [EEARH:EEARL:EEDR:EECR] io_cpu.bmp EEPROM Read/Write Access. The EEPROM access registers are accessible in the I/O space. The write access time for the EEPROM is given in Table 1. A self-timing function, however, lets the user software detect when the next byte can be written. If the user code contains instructions that write the EEPROM, some precautions must be taken. In heavily filtered power supplies, V CC is likely to rise or fall slowly on power-up/down. This causes the device for some period of time to run at a voltage lower than specified as minimum for the clock frequency used. See “Preventing EEPROM Corruption” on page 19. for details on how to avoid problems in these situations.In order to prevent unintentional EEPROM writes, a specific write procedure must be followed. Refer to the description of the EEPROM Control Register for details on this. When the EEPROM is read, the CPU is halted for four clock cycles before the next instruction is executed. When theEEPROM is written, the CPU is halted for two clock cycles before the next instruction is execute EEARH EEPROM Address Register Low Byte Bits 11..0 - EEAR11..0: EEPROM Address The EEPROM Address Registers - EEARH and EEARL specify the EEPROM address in the 4K bytes EEPROM space. The EEPROM data bytes are addressed linearly between 0 and 4096. The initial value of EEAR is undefined. A proper value must be written before the EEPROM may be accessed. $22 $42 io_cpu.bmp N EEAR11 EEPROM Read/Write Access Bit 11 RW 0 EEAR10 EEPROM Read/Write Access Bit 10 RW 0 EEAR9 EEPROM Read/Write Access Bit 9 RW 0 EEAR8 EEPROM Read/Write Access Bit 8 RW 0 EEARL EEPROM Address Register Low Byte Bits 11..0 - EEAR11..0: EEPROM Address The EEPROM Address Registers - EEARH and EEARL specify the EEPROM address in the 4K bytes EEPROM space. The EEPROM data bytes are addressed linearly between 0 and 4096. The initial value of EEAR is undefined. A proper value must be written before the EEPROM may be accessed. $21 $41 io_cpu.bmp N EEAR7 EEPROM Read/Write Access Bit 7 RW 0 EEAR6 EEPROM Read/Write Access Bit 6 RW 0 EEAR5 EEPROM Read/Write Access Bit 5 RW 0 EEAR4 EEPROM Read/Write Access Bit 4 RW 0 EEAR3 EEPROM Read/Write Access Bit 3 RW 0 EEAR2 EEPROM Read/Write Access Bit 2 RW 0 EEAR1 EEPROM Read/Write Access Bit 1 RW 0 EEAR0 EEPROM Read/Write Access Bit 0 RW 0 EEDR EEPROM Data Register For the EEPROM write operation, the EEDR register contains the data to be written to the EEPROM in the address given by the EEAR register. For the EEPROM read operation, the EEDR contains the data read out from the EEPROM at the address given by EEAR. $20 $40 io_cpu.bmp N EEDR7 EEPROM Data Register bit 7 RW 0 EEDR6 EEPROM Data Register bit 6 RW 0 EEDR5 EEPROM Data Register bit 5 RW 0 EEDR4 EEPROM Data Register bit 4 RW 0 EEDR3 EEPROM Data Register bit 3 RW 0 EEDR2 EEPROM Data Register bit 2 RW 0 EEDR1 EEPROM Data Register bit 1 RW 0 EEDR0 EEPROM Data Register bit 0 RW 0 EECR EEPROM Control Register $1F $3F io_flag.bmp Y EEPM1 EEPROM Programming Mode Bit 1 The EEPROM Programming mode bit setting defines which programming action that will be triggered when writing EEPE. It is possible to program data in one atomic operation (erase the old value and program the new value) or to split the Erase and Write operations in two different operations. The Programming times for the different modes are shown in Table 2. While EEPE is set, any write to EEPMn will be ignored. During reset, the EEPMn bits will be reset to 0b00 unless the EEPROM is busy programming. RW X EEPM0 EEPROM Programming Mode Bit 0 The EEPROM Programming mode bit setting defines which programming action that will be triggered when writing EEPE. It is possible to program data in one atomic operation (erase the old value and program the new value) or to split the Erase and Write operations in two different operations. The Programming times for the different modes are shown in Table 2. While EEPE is set, any write to EEPMn will be ignored. During reset, the EEPMn bits will be reset to 0b00 unless the EEPROM is busy programming. RW X EERIE EEPROM Ready Interrupt Enable EEPROM Ready Interrupt Enable Writing EERIE to one enables the EEPROM Ready Interrupt if the I bit in SREG is set. Writing EERIE to zero disables the interrupt. The EEPROM Ready interrupt generates a constant interrupt when EEWE is cleared. RW 0 EEMPE EEPROM Master Write Enable The EEMWE bit determines whether setting EEWE to one causes the EEPROM to be written. When EEMWE is written to one, writing EEWE to one within 4 clock cycles will write data to the EEPROM at the selected address. If EEMWE is zero, writing EEWE to one will have no effect. When EEMWE has been written to one by software, hardware clears the bit to zero after four clock cycles. See the description of the EEWE bit for an EEPROM write procedure. RW 0 EEPE EEPROM Write Enable The EEPROM Write Enable Signal EEWE is the write strobe to the EEPROM. When address and data are correctly set up, the EEWE bit must be set to write the value into the EEPROM. The EEMWE bit must be set when the logical one is written to EEWE, otherwise no EEPROM write takes place. The following procedure should be followed when writing the EEPROM (the order of steps 3 and 4 is not essential): 1. Wait until EEWE becomes zero. 2. Wait until SPMEN in SPMCR becomes zero. 3. Write new EEPROM address to EEAR (optional). 4. Write new EEPROM data to EEDR (optional). 5. Write a logical one to the EEMWE bit while writing a zero to EEWE in EECR. 6. Within four clock cycles after setting EEMWE, write a logical one to EEWE. The EEPROM can not be programmed during a CPU write to the Flash memory. The software must check that the Flash programming is completed before initiating a new EEPROM write. Step 2 is only relevant if the software contains a boot loader allowing the CPU to program the Flash. If the Flash is never being updated by the CPU, step 2 can be omitted. See “Boot Loader Support - Read While Write self-programming” on page 228 for details about boot programming. Caution: An interrupt between step 5 and step 6 will make the write cycle fail, since the EEPROM Master Write Enable will time-out. If an interrupt routine accessing the EEPROM is interrupting another EEPROM access, the EEAR or EEDR regis-ter will be modified, causing the interrupted EEPROM access to fail. It is recommended to have the global interrupt flag cleared during the 4 last steps to avoid these problems. When the write access time has elapsed, the EEWE bit is cleared by hardware. The user software can poll this bit and wait for a zero before writing the next byte. When EEWE has been set, the CPU is halted for two cycles before the next instruc-tion is executed RW X EERE EEPROM Read Enable The EEPROM Read Enable Signal EERE is the read strobe to the EEPROM. When the correct address is set up in the EEAR register, the EERE bit must be written to a logic one to trigger the EEPROM read. The EEPROM read access takes one instruction, and the requested data is available immediately. When the EEPROM is read, the CPU is halted for four cycles before the next instruction is executed. The user should poll the EEWE bit before starting the read operation. If a write operation is in progress, it is neither possible to read the EEPROM, nor to change the EEAR register. The calibrated oscillator is used to time the EEPROM accesses. Table 1 lists the typical programming time for EEPROM access from the CPU RW 0 [TIMSK5:TIFR5:TCCR5A:TCCR5B:TCCR5C:TCNT5H:TCNT5L:OCR5AH:OCR5AL:OCR5BH:OCR5BL:ICR5H:ICR5L:OCR5CH:OCR5CL] [TCNT5H:TCNT5L];[OCR5AH:OCR5AL];[OCR5BH:OCR5BL];[OCR5CH:OCR5CL];[ICR5H:ICR3L] io_timer.bmp t16pwm5_00.xml TCCR5A Timer/Counter5 Control Register A NA $120 io_flag.bmp Y COM5A1 Compare Output Mode 1A, bit 1 The COM5A1 and COM5A0 control bits determine any output pin action following a compare match in Timer/Counter5. Any output pin actions affect pin OC5A - Output CompareA. This is an alternative function to an I/O port, and the corresponding direction control bit must be set (one) to control an output pin. The control configuration is shown in Table 10. RW 0 COM5A0 Compare Output Mode 5A, bit 0 The COM5A1 and COM5A0 control bits determine any output pin action following a compare match in Timer/Counter5. Any output pin actions affect pin OC5A - Output CompareA. This is an alternative function to an I/O port, and the corresponding direction control bit must be set (one) to control an output pin. The control configuration is shown in Table 10. RW 0 COM5B1 Compare Output Mode 5B, bit 1 The COM5B1 and COM5B0 control bits determine any output pin action following a compare match in Timer/Counter5. Any output pin actions affect pin OC5B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 COM5B0 Compare Output Mode 5B, bit 0 The COM5B1 and COM5B0 control bits determine any output pin action following a compare match in Timer/Counter5. Any output pin actions affect pin OC5B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 COM5C1 Compare Output Mode 5C, bit 1 The COM5C1 and COM5C0 control bits determine any output pin action following a compare match in Timer/Counter5. Any output pin actions affect pin OC5B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 COM5C0 Compare Output Mode 5C, bit 0 The COM5C1 and COM5C0 control bits determine any output pin action following a compare match in Timer/Counter5. Any output pin actions affect pin OC5B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 WGM51 Waveform Generation Mode Combined with the WGM53:2 bits found in the TCCR5B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 WGM50 Waveform Generation Mode Combined with the WGM53:2 bits found in the TCCR5B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 TCCR5B Timer/Counter5 Control Register B NA $121 io_flag.bmp Y ICNC5 Input Capture 5 Noise Canceler When the ICNC5 bit is cleared (zero), the input capture trigger noise canceler function is disabled. The input capture is triggered at the first rising/falling edge sampled on the ICP - input capture pin - as specified. When the ICNC5 bit is set (one), four successive samples are measures on the ICP - input capture pin, and all samples must be high/low according to the input capture trigger specification in the ICES5 bit. The actual sampling frequency is XTAL clock frequency. RW 0 ICES5 Input Capture 5 Edge Select While the ICES5 bit is cleared (zero), the Timer/Counter5 contents are transferred to the Input Capture Register - ICR5 - on the falling edge of the input capture pin - ICP. While the ICES5 bit is set (one), the Timer/Counter5 contents are transferred to the Input Capture Register - ICR5 - on the rising edge of the input capture pin - ICP. RW 0 WGM53 Waveform Generation Mode Combined with the WGM53:2 bits found in the TCCR5B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 WGM52 Waveform Generation Mode Combined with the WGM53:2 bits found in the TCCR5B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 CS52 Prescaler source of Timer/Counter 5 Select Prescaling Clock Source of Timer/Counter5. (0:0:0) = Stop. (0:0:1) = CK. (0:1:0) = CK / 8. (0:1:1) = CK / 64. (1:0:0) = CK / 256. (1:0:1) = CK / 1024. (1:1:0) = External Pin T5, falling edge. (1:1:1) = External Pin 1, rising edge. RW 0 CS51 Prescaler source of Timer/Counter 5 Select Prescaling Clock Source of Timer/Counter5. (0:0:0) = Stop. (0:0:1) = CK. (0:1:0) = CK / 8. (0:1:1) = CK / 64. (1:0:0) = CK / 256. (1:0:1) = CK / 1024. (1:1:0) = External Pin T5, falling edge. (1:1:1) = External Pin 1, rising edge. RW 0 CS50 Prescaler source of Timer/Counter 5 Select Prescaling Clock Source of Timer/Counter5. (0:0:0) = Stop. (0:0:1) = CK. (0:1:0) = CK / 8. (0:1:1) = CK / 64. (1:0:0) = CK / 256. (1:0:1) = CK / 1024. (1:1:0) = External Pin T1, falling edge. (1:1:1) = External Pin 1, rising edge. RW 0 TCCR5C Timer/Counter 5 Control Register C NA $122 io_flag.bmp Y FOC5A Force Output Compare 5A Writing a logical one to this bit, forces a change in the compare match output pin PD5 according to the values already set in COM5A1 and COM5A0.If the COM5A1 and COM5A0 bits are written in the same cycle as FOC5A,the new settings will not take effect until next compare match or forced compare match occurs. The Force Output Compare bit can be used to change the output pin without waiting for a compare match in the timer. The automatic action programmed in COM5A1 and COM5A0 happens as if a Compare Match had occurred, but no interrupt is generated and it will not clear the timer even if CTC5 in TCCR5B is set. The corresponding I/O pin must be set as an output pin for the FOC5A bit to have effect on the pin. The FOC5A bit will always be read as zero. The setting of the FOC5A bit has no effect in PWM m RW 0 FOC5B Force Output Compare 5B Writing a logical one to this bit, forces a change in the compare match output pin PD4 according to the values already set in COM5B1 and COM5B0.If the COM5B1 and COM5B0 bits are written in the same cycle as FOC5B,the new settings will not take effect until next compare match or forced compare match occurs. The Force Output Compare bit can be used to change the output pin without waiting for a compare match in the timer. The automatic action programmed in COM5B1 and COM5B0 happens as if a Compare Match had occurred, but no interrupt is generated. The corresponding I/O pin must be set as an output pin for the FOC5B bit to have effect on the pin. The FOC5B bit will always be read as zero. The setting of the FOC5B bit has no effect in PWM mo RW 0 FOC5C Force Output Compare 5C Writing a logical one to this bit, forces a change in the compare match output pin PD4 according to the values already set in COM5B1 and COM5B0.If the COM5B1 and COM5B0 bits are written in the same cycle as FOC5B,the new settings will not take effect until next compare match or forced compare match occurs. The Force Output Compare bit can be used to change the output pin without waiting for a compare match in the timer. The automatic action programmed in COM5B1 and COM5B0 happens as if a Compare Match had occurred, but no interrupt is generated. The corresponding I/O pin must be set as an output pin for the FOC5B bit to have effect on the pin. The FOC5B bit will always be read as zero. The setting of the FOC5B bit has no effect in PWM mo RW 0 TCNT5H Timer/Counter5 High Byte This 16-bit register contains the prescaled value of the 16-bit Timer/Counter5. To ensure that both the high and low bytes are read and written simultaneously when the CPU accesses these registers, the access is performed using an 8-bit temporary register (TEMP). This temporary register is also used when accessing OCR5A, OCR5B and ICR5. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt rou NA $125 io_timer.bmp N TCNT5H7 Timer/Counter5 High Byte bit 7 RW 0 TCNT5H6 Timer/Counter5 High Byte bit 6 RW 0 TCNT5H5 Timer/Counter5 High Byte bit 5 RW 0 TCNT5H4 Timer/Counter5 High Byte bit 4 RW 0 TCNT5H3 Timer/Counter5 High Byte bit 3 RW 0 TCNT5H2 Timer/Counter5 High Byte bit 2 RW 0 TCNT5H1 Timer/Counter5 High Byte bit 1 RW 0 TCNT5H0 Timer/Counter5 High Byte bit 0 RW 0 TCNT5L Timer/Counter5 Low Byte This 16-bit register contains the prescaled value of the 16-bit Timer/Counter5. To ensure that both the high and low bytes are read and written simultaneously when the CPU accesses these registers, the access is performed using an 8-bit temporary register (TEMP). This temporary register is also used when accessing OCR5A, OCR5B and ICR5. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interru NA $124 io_timer.bmp N TCNT5L7 Timer/Counter5 Low Byte bit 7 RW 0 TCNT5L6 Timer/Counter5 Low Byte bit 6 RW 0 TCNT5L5 Timer/Counter5 Low Byte bit 5 RW 0 TCNT5L4 Timer/Counter5 Low Byte bit 4 RW 0 TCNT5L3 Timer/Counter5 Low Byte bit 3 RW 0 TCNT5L2 Timer/Counter5 Low Byte bit 2 RW 0 TCNT5L1 Timer/Counter5 Low Byte bit 1 RW 0 TCNT5L0 Timer/Counter5 Low Byte bit 0 RW 0 OCR5AH Timer/Counter5 Outbut Compare Register A High Byte The output compare registers are 16-bit read/write registers. The Timer/Counter5 Output Compare Registers contain the data to be continuously compared with Timer/Counter5. Actions on compare matches are specified in the Timer/Counter5 Control and Status register.A compare match does only occur if Timer/Counter5 counts to the OCR value. A software write that sets TCNT5 and OCR5A or OCR5B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR5A and OCR5B - are 16-bit registers, a temporary register TEMP is used when OCR5A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR5AH or OCR5BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR5AL or OCR5BL, the TEMP register is simultaneously written to OCR5AH or OCR5BH. Consequently, the high byte OCR5AH or OCR5BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT5, and ICR5. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interr NA $129 io_timer.bmp N OCR5AH7 Timer/Counter5 Outbut Compare Register High Byte bit 7 RW 0 OCR5AH6 Timer/Counter5 Outbut Compare Register High Byte bit 6 RW 0 OCR5AH5 Timer/Counter5 Outbut Compare Register High Byte bit 5 RW 0 OCR5AH4 Timer/Counter5 Outbut Compare Register High Byte bit 4 RW 0 OCR5AH3 Timer/Counter5 Outbut Compare Register High Byte bit 3 RW 0 OCR5AH2 Timer/Counter5 Outbut Compare Register High Byte bit 2 RW 0 OCR5AH1 Timer/Counter5 Outbut Compare Register High Byte bit 1 RW 0 OCR5AH0 Timer/Counter5 Outbut Compare Register High Byte bit 0 RW 0 OCR5AL Timer/Counter5 Outbut Compare Register A Low Byte The output compare registers are 16-bit read/write registers. The Timer/Counter5 Output Compare Registers contain the data to be continuously compared with Timer/Counter5. Actions on compare matches are specified in the Timer/Counter5 Control and Status register.A compare match does only occur if Timer/Counter5 counts to the OCR value. A software write that sets TCNT5 and OCR5A or OCR5B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR5A and OCR5B - are 16-bit registers, a temporary register TEMP is used when OCR5A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR5AH or OCR5BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR5AL or OCR5BL, the TEMP register is simultaneously written to OCR5AH or OCR5BH. Consequently, the high byte OCR5AH or OCR5BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT5, and ICR5. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interru NA $128 io_timer.bmp N OCR5AL7 Timer/Counter5 Outbut Compare Register Low Byte Bit 7 RW 0 OCR5AL6 Timer/Counter5 Outbut Compare Register Low Byte Bit 6 RW 0 OCR5AL5 Timer/Counter5 Outbut Compare Register Low Byte Bit 5 RW 0 OCR5AL4 Timer/Counter5 Outbut Compare Register Low Byte Bit 4 RW 0 OCR5AL3 Timer/Counter5 Outbut Compare Register Low Byte Bit 3 RW 0 OCR5AL2 Timer/Counter5 Outbut Compare Register Low Byte Bit 2 RW 0 OCR5AL1 Timer/Counter5 Outbut Compare Register Low Byte Bit 1 RW 0 OCR5AL0 Timer/Counter5 Outbut Compare Register Low Byte Bit 0 RW 0 OCR5BH Timer/Counter5 Output Compare Register B High Byte The output compare registers are 16-bit read/write registers. The Timer/Counter5 Output Compare Registers contain the data to be continuously compared with Timer/Counter5. Actions on compare matches are specified in the Timer/Counter5 Control and Status register.A compare match does only occur if Timer/Counter5 counts to the OCR value. A software write that sets TCNT5 and OCR5A or OCR5B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR5A and OCR5B - are 16-bit registers, a temporary register TEMP is used when OCR5A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR5AH or OCR5BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR5AL or OCR5BL, the TEMP register is simultaneously written to OCR5AH or OCR5BH. Consequently, the high byte OCR5AH or OCR5BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT5, and ICR5. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt r NA $12B io_timer.bmp N OCR5BH7 Timer/Counter5 Output Compare Register High Byte bit 7 RW 0 OCR5BH6 Timer/Counter5 Output Compare Register High Byte bit 6 RW 0 OCR5BH5 Timer/Counter5 Output Compare Register High Byte bit 5 RW 0 OCR5BH4 Timer/Counter5 Output Compare Register High Byte bit 4 RW 0 OCR5BH3 Timer/Counter5 Output Compare Register High Byte bit 3 RW 0 OCR5BH2 Timer/Counter5 Output Compare Register High Byte bit 2 RW 0 OCR5BH1 Timer/Counter5 Output Compare Register High Byte bit 1 RW 0 OCR5BH0 Timer/Counter5 Output Compare Register High Byte bit 0 RW 0 OCR5BL Timer/Counter5 Output Compare Register B Low Byte The output compare registers are 16-bit read/write registers. The Timer/Counter5 Output Compare Registers contain the data to be continuously compared with Timer/Counter5. Actions on compare matches are specified in the Timer/Counter5 Control and Status register.A compare match does only occur if Timer/Counter5 counts to the OCR value. A software write that sets TCNT5 and OCR5A or OCR5B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR5A and OCR5B - are 16-bit registers, a temporary register TEMP is used when OCR5A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR5AH or OCR5BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR5AL or OCR5BL, the TEMP register is simultaneously written to OCR5AH or OCR5BH. Consequently, the high byte OCR5AH or OCR5BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT5, and ICR5. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt rout NA $12A io_timer.bmp N OCR5BL7 Timer/Counter5 Output Compare Register Low Byte bit 7 R 0 OCR5BL6 Timer/Counter5 Output Compare Register Low Byte bit 6 RW 0 OCR5BL5 Timer/Counter5 Output Compare Register Low Byte bit 5 RW 0 OCR5BL4 Timer/Counter5 Output Compare Register Low Byte bit 4 RW 0 OCR5BL3 Timer/Counter5 Output Compare Register Low Byte bit 3 RW 0 OCR5BL2 Timer/Counter5 Output Compare Register Low Byte bit 2 RW 0 OCR5BL1 Timer/Counter5 Output Compare Register Low Byte bit 1 RW 0 OCR5BL0 Timer/Counter5 Output Compare Register Low Byte bit 0 RW 0 OCR5CH Timer/Counter5 Output Compare Register B High Byte The output compare registers are 16-bit read/write registers. The Timer/Counter5 Output Compare Registers contain the data to be continuously compared with Timer/Counter5. Actions on compare matches are specified in the Timer/Counter5 Control and Status register.A compare match does only occur if Timer/Counter5 counts to the OCR value. A software write that sets TCNT5 and OCR5A or OCR5B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR5A and OCR5B - are 16-bit registers, a temporary register TEMP is used when OCR5A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR5AH or OCR5BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR5AL or OCR5BL, the TEMP register is simultaneously written to OCR5AH or OCR5BH. Consequently, the high byte OCR5AH or OCR5BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT5, and ICR5. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt r NA $12D io_timer.bmp N OCR5CH7 Timer/Counter5 Output Compare Register High Byte bit 7 RW 0 OCR5CH6 Timer/Counter5 Output Compare Register High Byte bit 6 RW 0 OCR5CH5 Timer/Counter5 Output Compare Register High Byte bit 5 RW 0 OCR5CH4 Timer/Counter5 Output Compare Register High Byte bit 4 RW 0 OCR5CH3 Timer/Counter5 Output Compare Register High Byte bit 3 RW 0 OCR5CH2 Timer/Counter5 Output Compare Register High Byte bit 2 RW 0 OCR5CH1 Timer/Counter5 Output Compare Register High Byte bit 1 RW 0 OCR5CH0 Timer/Counter5 Output Compare Register High Byte bit 0 RW 0 OCR5CL Timer/Counter5 Output Compare Register B Low Byte The output compare registers are 16-bit read/write registers. The Timer/Counter5 Output Compare Registers contain the data to be continuously compared with Timer/Counter5. Actions on compare matches are specified in the Timer/Counter5 Control and Status register.A compare match does only occur if Timer/Counter5 counts to the OCR value. A software write that sets TCNT5 and OCR5A or OCR5B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR5A and OCR5B - are 16-bit registers, a temporary register TEMP is used when OCR5A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR5AH or OCR5BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR5AL or OCR5BL, the TEMP register is simultaneously written to OCR5AH or OCR5BH. Consequently, the high byte OCR5AH or OCR5BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT5, and ICR5. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt rout NA $12C io_timer.bmp N OCR5CL7 Timer/Counter5 Output Compare Register Low Byte bit 7 R 0 OCR5CL6 Timer/Counter5 Output Compare Register Low Byte bit 6 RW 0 OCR5CL5 Timer/Counter5 Output Compare Register Low Byte bit 5 RW 0 OCR5CL4 Timer/Counter5 Output Compare Register Low Byte bit 4 RW 0 OCR5CL3 Timer/Counter5 Output Compare Register Low Byte bit 3 RW 0 OCR5CL2 Timer/Counter5 Output Compare Register Low Byte bit 2 RW 0 OCR5CL1 Timer/Counter5 Output Compare Register Low Byte bit 1 RW 0 OCR5CL0 Timer/Counter5 Output Compare Register Low Byte bit 0 RW 0 ICR5H Timer/Counter5 Input Capture Register High Byte The input capture register is a 16-bit read-only register. When the rising or falling edge (according to the input capture edge setting - ICES5) of the signal at the input capture pin -ICP - is detected, the current value of the Timer/Counter5 is transferred to the Input Capture Register - ICR5. At the same time, the input capture flag - ICF5 - is set (one). Since the Input Capture Register - ICR5 - is a 16-bit register, a temporary register TEMP is used when ICR5 is read to ensure that both bytes are read simultaneously. When the CPU reads the low byte ICR5L, the data is sent to the CPU and the data of the high byte ICR5H is placed in the TEMP register. When the CPU reads the data in the high byte ICR5H, the CPU receives the data in the TEMP register. Consequently, the low byte ICR5L must be accessed first for a full 16-bit register read operation. The TEMP register is also used when accessing TCNT5, OCR5A and OCR5B. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt NA $127 io_timer.bmp N ICR5H7 Timer/Counter5 Input Capture Register High Byte bit 7 RW 0 ICR5H6 Timer/Counter5 Input Capture Register High Byte bit 6 R 0 ICR5H5 Timer/Counter5 Input Capture Register High Byte bit 5 R 0 ICR5H4 Timer/Counter5 Input Capture Register High Byte bit 4 R 0 ICR5H3 Timer/Counter5 Input Capture Register High Byte bit 3 R 0 ICR5H2 Timer/Counter5 Input Capture Register High Byte bit 2 R 0 ICR5H1 Timer/Counter5 Input Capture Register High Byte bit 1 R 0 ICR5H0 Timer/Counter5 Input Capture Register High Byte bit 0 R 0 ICR5L Timer/Counter5 Input Capture Register Low Byte The input capture register is a 16-bit read-only register. When the rising or falling edge (according to the input capture edge setting - ICES5) of the signal at the input capture pin -ICP - is detected, the current value of the Timer/Counter5 is transferred to the Input Capture Register - ICR5. At the same time, the input capture flag - ICF5 - is set (one). Since the Input Capture Register - ICR5 - is a 16-bit register, a temporary register TEMP is used when ICR5 is read to ensure that both bytes are read simultaneously. When the CPU reads the low byte ICR5L, the data is sent to the CPU and the data of the high byte ICR5H is placed in the TEMP register. When the CPU reads the data in the high byte ICR5H, the CPU receives the data in the TEMP register. Consequently, the low byte ICR5L must be accessed first for a full 16-bit register read operation. The TEMP register is also used when accessing TCNT5, OCR5A and OCR5B. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within inter NA $126 io_timer.bmp N ICR5L7 Timer/Counter5 Input Capture Register Low Byte bit 7 R 0 ICR5L6 Timer/Counter5 Input Capture Register Low Byte bit 6 R 0 ICR5L5 Timer/Counter5 Input Capture Register Low Byte bit 5 R 0 ICR5L4 Timer/Counter5 Input Capture Register Low Byte bit 4 R 0 ICR5L3 Timer/Counter5 Input Capture Register Low Byte bit 3 R 0 ICR5L2 Timer/Counter5 Input Capture Register Low Byte bit 2 R 0 ICR5L1 Timer/Counter5 Input Capture Register Low Byte bit 1 R 0 ICR5L0 Timer/Counter5 Input Capture Register Low Byte bit 0 R 0 TIMSK5 Timer/Counter5 Interrupt Mask Register NA $73 io_flag.bmp Y ICIE5 Timer/Counter5 Input Capture Interrupt Enable When the TICIE5 bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter5 Input Capture Event Interrupt is enabled. The corresponding interrupt (at vector $003) is executed if a capture-triggering event occurs on pin 31, ICP, i.e., when the ICF5 bit is set in the Timer/Counter Interrupt Flag Register - TIFR. RW 0 OCIE5C Timer/Counter5 Output Compare C Match Interrupt Enable When the OCIE5C bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter5 CompareB Match interrupt is enabled. The corresponding interrupt (at vector $005) is executed if a CompareB match in Timer/Counter5 occurs, i.e., when the OCF5B bit is set in the Timer/Counter Interrupt Flag Register - TIFR. R 0 OCIE5B Timer/Counter5 Output Compare B Match Interrupt Enable When the OCIE5B bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter5 CompareB Match interrupt is enabled. The corresponding interrupt (at vector $005) is executed if a CompareB match in Timer/Counter5 occurs, i.e., when the OCF5B bit is set in the Timer/Counter Interrupt Flag Register - TIFR. R 0 OCIE5A Timer/Counter5 Output Compare A Match Interrupt Enable When the OCIE5A bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter5 CompareA Match interrupt is enabled. The corresponding interrupt (at vector $004) is executed if a CompareA match in Timer/Counter5 occurs, i.e., when the OCF5A bit is set in the Timer/Counter Interrupt Flag Register - TIFR. RW 0 TOIE5 Timer/Counter5 Overflow Interrupt Enable When the TOIE5 bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter5 Overflow interrupt is enabled. The corresponding interrupt (at vector $006) is executed if an overflow in Timer/Counter5 occurs, i.e., when the TOV5 bit is set in the Timer/Counter Interrupt Flag Register - TIFR. RW 0 TIFR5 Timer/Counter5 Interrupt Flag register $1A $3A io_flag.bmp Y ICF5 Input Capture Flag 5 The ICF5 bit is set (one) to flag an input capture event, indicating that the Timer/Counter5 value has been transferred to the input capture register - ICR5. ICF5 is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, ICF5 is cleared by writing a logic one to the flag. When the SREG I-bit, and TICIE5 (Timer/Counter5 Input Capture Interrupt Enable), and ICF5 are set (one), the Timer/Counter5 Capture Interrupt is executed. RW 0 OCF5C Output Compare Flag 5C The OCF5C bit is set (one) when compare match occurs between the Timer/Counter5 and the data in OCR5B - Output Compare Register 5B. OCF5B is cleared by hardware when executing the corresponding interrupt handling vector. Alterna-tively, OCF5B is cleared by writing a logic one to the flag. When the I-bit in SREG, and OCIE5B (Timer/Counter5 Compare match InterruptB Enable), and the OCF5B are set (one), the Timer/Counter5 Compare B match Interrupt is executed. RW 0 OCF5B Output Compare Flag 5B The OCF5B bit is set (one) when compare match occurs between the Timer/Counter5 and the data in OCR5B - Output Compare Register 5B. OCF5B is cleared by hardware when executing the corresponding interrupt handling vector. Alterna-tively, OCF5B is cleared by writing a logic one to the flag. When the I-bit in SREG, and OCIE5B (Timer/Counter5 Compare match InterruptB Enable), and the OCF5B are set (one), the Timer/Counter5 Compare B match Interrupt is executed. RW 0 OCF5A Output Compare Flag 5A The OCF5A bit is set (one) when compare match occurs between the Timer/Counter5 and the data in OCR5A - Output Compare Register 5A. OCF5A is cleared by hardware when executing the corresponding interrupt handling vector. Alterna-tively, OCF5A is cleared by writing a logic one to the flag. When the I-bit in SREG, and OCIE5A (Timer/Counter5 Compare match InterruptA Enable), and the OCF5A are set (one), the Timer/Counter5 Compare A match Interrupt is executed. RW 0 TOV5 Timer/Counter5 Overflow Flag The TOV5 is set (one) when an overflow occurs in Timer/Counter5. TOV5 is cleared by hardware when executing the cor-responding interrupt handling vector. Alternatively, TOV5 is cleared by writing a logic one to the flag. When the I-bit in SREG, and TOIE5 (Timer/Counter5 Overflow Interrupt Enable), and TOV5 are set (one), the Timer/Counter5 Overflow Interrupt is executed. In PWM mode, this bit is set when Timer/Counter5 changes counting direction at $0000. RW 0 [TIMSK4:TIFR4:TCCR4A:TCCR4B:TCCR4C:TCNT4H:TCNT4L:OCR4AH:OCR4AL:OCR4BH:OCR4BL:ICR4H:ICR4L:OCR4CH:OCR4CL] [TCNT4H:TCNT4L];[OCR4AH:OCR4AL];[OCR4BH:OCR4BL];[OCR4CH:OCR4CL];[ICR4H:ICR4L] io_timer.bmp t16pwm4_00.xml TCCR4A Timer/Counter4 Control Register A NA $A0 io_flag.bmp Y COM4A1 Compare Output Mode 1A, bit 1 The COM4A1 and COM4A0 control bits determine any output pin action following a compare match in Timer/Counter4. Any output pin actions affect pin OC4A - Output CompareA. This is an alternative function to an I/O port, and the corresponding direction control bit must be set (one) to control an output pin. The control configuration is shown in Table 10. RW 0 COM4A0 Compare Output Mode 4A, bit 0 The COM4A1 and COM4A0 control bits determine any output pin action following a compare match in Timer/Counter4. Any output pin actions affect pin OC4A - Output CompareA. This is an alternative function to an I/O port, and the corresponding direction control bit must be set (one) to control an output pin. The control configuration is shown in Table 10. RW 0 COM4B1 Compare Output Mode 4B, bit 1 The COM4B1 and COM4B0 control bits determine any output pin action following a compare match in Timer/Counter4. Any output pin actions affect pin OC4B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 COM4B0 Compare Output Mode 4B, bit 0 The COM4B1 and COM4B0 control bits determine any output pin action following a compare match in Timer/Counter4. Any output pin actions affect pin OC4B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 COM4C1 Compare Output Mode 4C, bit 1 The COM4C1 and COM4C0 control bits determine any output pin action following a compare match in Timer/Counter4. Any output pin actions affect pin OC4B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 COM4C0 Compare Output Mode 4C, bit 0 The COM4C1 and COM4C0 control bits determine any output pin action following a compare match in Timer/Counter4. Any output pin actions affect pin OC4B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 WGM41 Waveform Generation Mode Combined with the WGM43:2 bits found in the TCCR4B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 WGM40 Waveform Generation Mode Combined with the WGM43:2 bits found in the TCCR4B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 TCCR4B Timer/Counter4 Control Register B NA $A1 io_flag.bmp Y ICNC4 Input Capture 4 Noise Canceler When the ICNC4 bit is cleared (zero), the input capture trigger noise canceler function is disabled. The input capture is triggered at the first rising/falling edge sampled on the ICP - input capture pin - as specified. When the ICNC4 bit is set (one), four successive samples are measures on the ICP - input capture pin, and all samples must be high/low according to the input capture trigger specification in the ICES4 bit. The actual sampling frequency is XTAL clock frequency. RW 0 ICES4 Input Capture 4 Edge Select While the ICES4 bit is cleared (zero), the Timer/Counter4 contents are transferred to the Input Capture Register - ICR4 - on the falling edge of the input capture pin - ICP. While the ICES4 bit is set (one), the Timer/Counter4 contents are transferred to the Input Capture Register - ICR4 - on the rising edge of the input capture pin - ICP. RW 0 WGM43 Waveform Generation Mode Combined with the WGM43:2 bits found in the TCCR4B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 WGM42 Waveform Generation Mode Combined with the WGM43:2 bits found in the TCCR4B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 CS42 Prescaler source of Timer/Counter 4 Select Prescaling Clock Source of Timer/Counter4. (0:0:0) = Stop. (0:0:1) = CK. (0:1:0) = CK / 8. (0:1:1) = CK / 64. (1:0:0) = CK / 256. (1:0:1) = CK / 1024. (1:1:0) = External Pin T4, falling edge. (1:1:1) = External Pin 1, rising edge. RW 0 CS41 Prescaler source of Timer/Counter 4 Select Prescaling Clock Source of Timer/Counter4. (0:0:0) = Stop. (0:0:1) = CK. (0:1:0) = CK / 8. (0:1:1) = CK / 64. (1:0:0) = CK / 256. (1:0:1) = CK / 1024. (1:1:0) = External Pin T4, falling edge. (1:1:1) = External Pin 1, rising edge. RW 0 CS40 Prescaler source of Timer/Counter 4 Select Prescaling Clock Source of Timer/Counter4. (0:0:0) = Stop. (0:0:1) = CK. (0:1:0) = CK / 8. (0:1:1) = CK / 64. (1:0:0) = CK / 256. (1:0:1) = CK / 1024. (1:1:0) = External Pin T1, falling edge. (1:1:1) = External Pin 1, rising edge. RW 0 TCCR4C Timer/Counter 4 Control Register C NA $A2 io_flag.bmp Y FOC4A Force Output Compare 4A Writing a logical one to this bit, forces a change in the compare match output pin PD5 according to the values already set in COM4A1 and COM4A0.If the COM4A1 and COM4A0 bits are written in the same cycle as FOC4A,the new settings will not take effect until next compare match or forced compare match occurs. The Force Output Compare bit can be used to change the output pin without waiting for a compare match in the timer. The automatic action programmed in COM4A1 and COM4A0 happens as if a Compare Match had occurred, but no interrupt is generated and it will not clear the timer even if CTC4 in TCCR4B is set. The corresponding I/O pin must be set as an output pin for the FOC4A bit to have effect on the pin. The FOC4A bit will always be read as zero. The setting of the FOC4A bit has no effect in PWM m RW 0 FOC4B Force Output Compare 4B Writing a logical one to this bit, forces a change in the compare match output pin PD4 according to the values already set in COM4B1 and COM4B0.If the COM4B1 and COM4B0 bits are written in the same cycle as FOC4B,the new settings will not take effect until next compare match or forced compare match occurs. The Force Output Compare bit can be used to change the output pin without waiting for a compare match in the timer. The automatic action programmed in COM4B1 and COM4B0 happens as if a Compare Match had occurred, but no interrupt is generated. The corresponding I/O pin must be set as an output pin for the FOC4B bit to have effect on the pin. The FOC4B bit will always be read as zero. The setting of the FOC4B bit has no effect in PWM mo RW 0 FOC4C Force Output Compare 4C Writing a logical one to this bit, forces a change in the compare match output pin PD4 according to the values already set in COM4B1 and COM4B0.If the COM4B1 and COM4B0 bits are written in the same cycle as FOC4B,the new settings will not take effect until next compare match or forced compare match occurs. The Force Output Compare bit can be used to change the output pin without waiting for a compare match in the timer. The automatic action programmed in COM4B1 and COM4B0 happens as if a Compare Match had occurred, but no interrupt is generated. The corresponding I/O pin must be set as an output pin for the FOC4B bit to have effect on the pin. The FOC4B bit will always be read as zero. The setting of the FOC4B bit has no effect in PWM mo RW 0 TCNT4H Timer/Counter4 High Byte This 16-bit register contains the prescaled value of the 16-bit Timer/Counter4. To ensure that both the high and low bytes are read and written simultaneously when the CPU accesses these registers, the access is performed using an 8-bit temporary register (TEMP). This temporary register is also used when accessing OCR4A, OCR4B and ICR4. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt rou NA $A5 io_timer.bmp N TCNT4H7 Timer/Counter4 High Byte bit 7 RW 0 TCNT4H6 Timer/Counter4 High Byte bit 6 RW 0 TCNT4H5 Timer/Counter4 High Byte bit 5 RW 0 TCNT4H4 Timer/Counter4 High Byte bit 4 RW 0 TCNT4H3 Timer/Counter4 High Byte bit 3 RW 0 TCNT4H2 Timer/Counter4 High Byte bit 2 RW 0 TCNT4H1 Timer/Counter4 High Byte bit 1 RW 0 TCNT4H0 Timer/Counter4 High Byte bit 0 RW 0 TCNT4L Timer/Counter4 Low Byte This 16-bit register contains the prescaled value of the 16-bit Timer/Counter4. To ensure that both the high and low bytes are read and written simultaneously when the CPU accesses these registers, the access is performed using an 8-bit temporary register (TEMP). This temporary register is also used when accessing OCR4A, OCR4B and ICR4. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interru NA $A4 io_timer.bmp N TCNT4L7 Timer/Counter4 Low Byte bit 7 RW 0 TCNT4L6 Timer/Counter4 Low Byte bit 6 RW 0 TCNT4L5 Timer/Counter4 Low Byte bit 5 RW 0 TCNT4L4 Timer/Counter4 Low Byte bit 4 RW 0 TCNT4L3 Timer/Counter4 Low Byte bit 3 RW 0 TCNT4L2 Timer/Counter4 Low Byte bit 2 RW 0 TCNT4L1 Timer/Counter4 Low Byte bit 1 RW 0 TCNT4L0 Timer/Counter4 Low Byte bit 0 RW 0 OCR4AH Timer/Counter4 Outbut Compare Register A High Byte The output compare registers are 16-bit read/write registers. The Timer/Counter4 Output Compare Registers contain the data to be continuously compared with Timer/Counter4. Actions on compare matches are specified in the Timer/Counter4 Control and Status register.A compare match does only occur if Timer/Counter4 counts to the OCR value. A software write that sets TCNT4 and OCR4A or OCR4B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR4A and OCR4B - are 16-bit registers, a temporary register TEMP is used when OCR4A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR4AH or OCR4BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR4AL or OCR4BL, the TEMP register is simultaneously written to OCR4AH or OCR4BH. Consequently, the high byte OCR4AH or OCR4BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT4, and ICR4. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interr NA $A9 io_timer.bmp N OCR4AH7 Timer/Counter4 Outbut Compare Register High Byte bit 7 RW 0 OCR4AH6 Timer/Counter4 Outbut Compare Register High Byte bit 6 RW 0 OCR4AH5 Timer/Counter4 Outbut Compare Register High Byte bit 5 RW 0 OCR4AH4 Timer/Counter4 Outbut Compare Register High Byte bit 4 RW 0 OCR4AH3 Timer/Counter4 Outbut Compare Register High Byte bit 3 RW 0 OCR4AH2 Timer/Counter4 Outbut Compare Register High Byte bit 2 RW 0 OCR4AH1 Timer/Counter4 Outbut Compare Register High Byte bit 1 RW 0 OCR4AH0 Timer/Counter4 Outbut Compare Register High Byte bit 0 RW 0 OCR4AL Timer/Counter4 Outbut Compare Register A Low Byte The output compare registers are 16-bit read/write registers. The Timer/Counter4 Output Compare Registers contain the data to be continuously compared with Timer/Counter4. Actions on compare matches are specified in the Timer/Counter4 Control and Status register.A compare match does only occur if Timer/Counter4 counts to the OCR value. A software write that sets TCNT4 and OCR4A or OCR4B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR4A and OCR4B - are 16-bit registers, a temporary register TEMP is used when OCR4A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR4AH or OCR4BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR4AL or OCR4BL, the TEMP register is simultaneously written to OCR4AH or OCR4BH. Consequently, the high byte OCR4AH or OCR4BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT4, and ICR4. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interru NA $A8 io_timer.bmp N OCR4AL7 Timer/Counter4 Outbut Compare Register Low Byte Bit 7 RW 0 OCR4AL6 Timer/Counter4 Outbut Compare Register Low Byte Bit 6 RW 0 OCR4AL5 Timer/Counter4 Outbut Compare Register Low Byte Bit 5 RW 0 OCR4AL4 Timer/Counter4 Outbut Compare Register Low Byte Bit 4 RW 0 OCR4AL3 Timer/Counter4 Outbut Compare Register Low Byte Bit 3 RW 0 OCR4AL2 Timer/Counter4 Outbut Compare Register Low Byte Bit 2 RW 0 OCR4AL1 Timer/Counter4 Outbut Compare Register Low Byte Bit 1 RW 0 OCR4AL0 Timer/Counter4 Outbut Compare Register Low Byte Bit 0 RW 0 OCR4BH Timer/Counter4 Output Compare Register B High Byte The output compare registers are 16-bit read/write registers. The Timer/Counter4 Output Compare Registers contain the data to be continuously compared with Timer/Counter4. Actions on compare matches are specified in the Timer/Counter4 Control and Status register.A compare match does only occur if Timer/Counter4 counts to the OCR value. A software write that sets TCNT4 and OCR4A or OCR4B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR4A and OCR4B - are 16-bit registers, a temporary register TEMP is used when OCR4A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR4AH or OCR4BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR4AL or OCR4BL, the TEMP register is simultaneously written to OCR4AH or OCR4BH. Consequently, the high byte OCR4AH or OCR4BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT4, and ICR4. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt r NA $AB io_timer.bmp N OCR4BH7 Timer/Counter4 Output Compare Register High Byte bit 7 RW 0 OCR4BH6 Timer/Counter4 Output Compare Register High Byte bit 6 RW 0 OCR4BH5 Timer/Counter4 Output Compare Register High Byte bit 5 RW 0 OCR4BH4 Timer/Counter4 Output Compare Register High Byte bit 4 RW 0 OCR4BH3 Timer/Counter4 Output Compare Register High Byte bit 3 RW 0 OCR4BH2 Timer/Counter4 Output Compare Register High Byte bit 2 RW 0 OCR4BH1 Timer/Counter4 Output Compare Register High Byte bit 1 RW 0 OCR4BH0 Timer/Counter4 Output Compare Register High Byte bit 0 RW 0 OCR4BL Timer/Counter4 Output Compare Register B Low Byte The output compare registers are 16-bit read/write registers. The Timer/Counter4 Output Compare Registers contain the data to be continuously compared with Timer/Counter4. Actions on compare matches are specified in the Timer/Counter4 Control and Status register.A compare match does only occur if Timer/Counter4 counts to the OCR value. A software write that sets TCNT4 and OCR4A or OCR4B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR4A and OCR4B - are 16-bit registers, a temporary register TEMP is used when OCR4A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR4AH or OCR4BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR4AL or OCR4BL, the TEMP register is simultaneously written to OCR4AH or OCR4BH. Consequently, the high byte OCR4AH or OCR4BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT4, and ICR4. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt rout NA $AA io_timer.bmp N OCR4BL7 Timer/Counter4 Output Compare Register Low Byte bit 7 R 0 OCR4BL6 Timer/Counter4 Output Compare Register Low Byte bit 6 RW 0 OCR4BL5 Timer/Counter4 Output Compare Register Low Byte bit 5 RW 0 OCR4BL4 Timer/Counter4 Output Compare Register Low Byte bit 4 RW 0 OCR4BL3 Timer/Counter4 Output Compare Register Low Byte bit 3 RW 0 OCR4BL2 Timer/Counter4 Output Compare Register Low Byte bit 2 RW 0 OCR4BL1 Timer/Counter4 Output Compare Register Low Byte bit 1 RW 0 OCR4BL0 Timer/Counter4 Output Compare Register Low Byte bit 0 RW 0 OCR4CH Timer/Counter4 Output Compare Register B High Byte The output compare registers are 16-bit read/write registers. The Timer/Counter4 Output Compare Registers contain the data to be continuously compared with Timer/Counter4. Actions on compare matches are specified in the Timer/Counter4 Control and Status register.A compare match does only occur if Timer/Counter4 counts to the OCR value. A software write that sets TCNT4 and OCR4A or OCR4B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR4A and OCR4B - are 16-bit registers, a temporary register TEMP is used when OCR4A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR4AH or OCR4BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR4AL or OCR4BL, the TEMP register is simultaneously written to OCR4AH or OCR4BH. Consequently, the high byte OCR4AH or OCR4BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT4, and ICR4. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt r NA $AD io_timer.bmp N OCR4CH7 Timer/Counter4 Output Compare Register High Byte bit 7 RW 0 OCR4CH6 Timer/Counter4 Output Compare Register High Byte bit 6 RW 0 OCR4CH5 Timer/Counter4 Output Compare Register High Byte bit 5 RW 0 OCR4CH4 Timer/Counter4 Output Compare Register High Byte bit 4 RW 0 OCR4CH3 Timer/Counter4 Output Compare Register High Byte bit 3 RW 0 OCR4CH2 Timer/Counter4 Output Compare Register High Byte bit 2 RW 0 OCR4CH1 Timer/Counter4 Output Compare Register High Byte bit 1 RW 0 OCR4CH0 Timer/Counter4 Output Compare Register High Byte bit 0 RW 0 OCR4CL Timer/Counter4 Output Compare Register B Low Byte The output compare registers are 16-bit read/write registers. The Timer/Counter4 Output Compare Registers contain the data to be continuously compared with Timer/Counter4. Actions on compare matches are specified in the Timer/Counter4 Control and Status register.A compare match does only occur if Timer/Counter4 counts to the OCR value. A software write that sets TCNT4 and OCR4A or OCR4B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR4A and OCR4B - are 16-bit registers, a temporary register TEMP is used when OCR4A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR4AH or OCR4BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR4AL or OCR4BL, the TEMP register is simultaneously written to OCR4AH or OCR4BH. Consequently, the high byte OCR4AH or OCR4BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT4, and ICR4. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt rout NA $AC io_timer.bmp N OCR4CL7 Timer/Counter4 Output Compare Register Low Byte bit 7 R 0 OCR4CL6 Timer/Counter4 Output Compare Register Low Byte bit 6 RW 0 OCR4CL5 Timer/Counter4 Output Compare Register Low Byte bit 5 RW 0 OCR4CL4 Timer/Counter4 Output Compare Register Low Byte bit 4 RW 0 OCR4CL3 Timer/Counter4 Output Compare Register Low Byte bit 3 RW 0 OCR4CL2 Timer/Counter4 Output Compare Register Low Byte bit 2 RW 0 OCR4CL1 Timer/Counter4 Output Compare Register Low Byte bit 1 RW 0 OCR4CL0 Timer/Counter4 Output Compare Register Low Byte bit 0 RW 0 ICR4H Timer/Counter4 Input Capture Register High Byte The input capture register is a 16-bit read-only register. When the rising or falling edge (according to the input capture edge setting - ICES4) of the signal at the input capture pin -ICP - is detected, the current value of the Timer/Counter4 is transferred to the Input Capture Register - ICR4. At the same time, the input capture flag - ICF4 - is set (one). Since the Input Capture Register - ICR4 - is a 16-bit register, a temporary register TEMP is used when ICR4 is read to ensure that both bytes are read simultaneously. When the CPU reads the low byte ICR4L, the data is sent to the CPU and the data of the high byte ICR4H is placed in the TEMP register. When the CPU reads the data in the high byte ICR4H, the CPU receives the data in the TEMP register. Consequently, the low byte ICR4L must be accessed first for a full 16-bit register read operation. The TEMP register is also used when accessing TCNT4, OCR4A and OCR4B. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt NA $A7 io_timer.bmp N ICR4H7 Timer/Counter4 Input Capture Register High Byte bit 7 RW 0 ICR4H6 Timer/Counter4 Input Capture Register High Byte bit 6 R 0 ICR4H5 Timer/Counter4 Input Capture Register High Byte bit 5 R 0 ICR4H4 Timer/Counter4 Input Capture Register High Byte bit 4 R 0 ICR4H3 Timer/Counter4 Input Capture Register High Byte bit 3 R 0 ICR4H2 Timer/Counter4 Input Capture Register High Byte bit 2 R 0 ICR4H1 Timer/Counter4 Input Capture Register High Byte bit 1 R 0 ICR4H0 Timer/Counter4 Input Capture Register High Byte bit 0 R 0 ICR4L Timer/Counter4 Input Capture Register Low Byte The input capture register is a 16-bit read-only register. When the rising or falling edge (according to the input capture edge setting - ICES4) of the signal at the input capture pin -ICP - is detected, the current value of the Timer/Counter4 is transferred to the Input Capture Register - ICR4. At the same time, the input capture flag - ICF4 - is set (one). Since the Input Capture Register - ICR4 - is a 16-bit register, a temporary register TEMP is used when ICR4 is read to ensure that both bytes are read simultaneously. When the CPU reads the low byte ICR4L, the data is sent to the CPU and the data of the high byte ICR4H is placed in the TEMP register. When the CPU reads the data in the high byte ICR4H, the CPU receives the data in the TEMP register. Consequently, the low byte ICR4L must be accessed first for a full 16-bit register read operation. The TEMP register is also used when accessing TCNT4, OCR4A and OCR4B. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within inter NA $A6 io_timer.bmp N ICR4L7 Timer/Counter4 Input Capture Register Low Byte bit 7 R 0 ICR4L6 Timer/Counter4 Input Capture Register Low Byte bit 6 R 0 ICR4L5 Timer/Counter4 Input Capture Register Low Byte bit 5 R 0 ICR4L4 Timer/Counter4 Input Capture Register Low Byte bit 4 R 0 ICR4L3 Timer/Counter4 Input Capture Register Low Byte bit 3 R 0 ICR4L2 Timer/Counter4 Input Capture Register Low Byte bit 2 R 0 ICR4L1 Timer/Counter4 Input Capture Register Low Byte bit 1 R 0 ICR4L0 Timer/Counter4 Input Capture Register Low Byte bit 0 R 0 TIMSK4 Timer/Counter4 Interrupt Mask Register NA $72 io_flag.bmp Y ICIE4 Timer/Counter4 Input Capture Interrupt Enable When the TICIE4 bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter4 Input Capture Event Interrupt is enabled. The corresponding interrupt (at vector $003) is executed if a capture-triggering event occurs on pin 31, ICP, i.e., when the ICF4 bit is set in the Timer/Counter Interrupt Flag Register - TIFR. RW 0 OCIE4C Timer/Counter4 Output Compare C Match Interrupt Enable When the OCIE4C bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter4 CompareB Match interrupt is enabled. The corresponding interrupt (at vector $005) is executed if a CompareB match in Timer/Counter4 occurs, i.e., when the OCF4B bit is set in the Timer/Counter Interrupt Flag Register - TIFR. R 0 OCIE4B Timer/Counter4 Output Compare B Match Interrupt Enable When the OCIE4B bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter4 CompareB Match interrupt is enabled. The corresponding interrupt (at vector $005) is executed if a CompareB match in Timer/Counter4 occurs, i.e., when the OCF4B bit is set in the Timer/Counter Interrupt Flag Register - TIFR. R 0 OCIE4A Timer/Counter4 Output Compare A Match Interrupt Enable When the OCIE4A bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter4 CompareA Match interrupt is enabled. The corresponding interrupt (at vector $004) is executed if a CompareA match in Timer/Counter4 occurs, i.e., when the OCF4A bit is set in the Timer/Counter Interrupt Flag Register - TIFR. RW 0 TOIE4 Timer/Counter4 Overflow Interrupt Enable When the TOIE4 bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter4 Overflow interrupt is enabled. The corresponding interrupt (at vector $006) is executed if an overflow in Timer/Counter4 occurs, i.e., when the TOV4 bit is set in the Timer/Counter Interrupt Flag Register - TIFR. RW 0 TIFR4 Timer/Counter4 Interrupt Flag register $19 $39 io_flag.bmp Y ICF4 Input Capture Flag 4 The ICF4 bit is set (one) to flag an input capture event, indicating that the Timer/Counter4 value has been transferred to the input capture register - ICR4. ICF4 is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, ICF4 is cleared by writing a logic one to the flag. When the SREG I-bit, and TICIE4 (Timer/Counter4 Input Capture Interrupt Enable), and ICF4 are set (one), the Timer/Counter4 Capture Interrupt is executed. RW 0 OCF4C Output Compare Flag 4C The OCF4C bit is set (one) when compare match occurs between the Timer/Counter4 and the data in OCR4B - Output Compare Register 4B. OCF4B is cleared by hardware when executing the corresponding interrupt handling vector. Alterna-tively, OCF4B is cleared by writing a logic one to the flag. When the I-bit in SREG, and OCIE4B (Timer/Counter4 Compare match InterruptB Enable), and the OCF4B are set (one), the Timer/Counter4 Compare B match Interrupt is executed. RW 0 OCF4B Output Compare Flag 4B The OCF4B bit is set (one) when compare match occurs between the Timer/Counter4 and the data in OCR4B - Output Compare Register 4B. OCF4B is cleared by hardware when executing the corresponding interrupt handling vector. Alterna-tively, OCF4B is cleared by writing a logic one to the flag. When the I-bit in SREG, and OCIE4B (Timer/Counter4 Compare match InterruptB Enable), and the OCF4B are set (one), the Timer/Counter4 Compare B match Interrupt is executed. RW 0 OCF4A Output Compare Flag 4A The OCF4A bit is set (one) when compare match occurs between the Timer/Counter4 and the data in OCR4A - Output Compare Register 4A. OCF4A is cleared by hardware when executing the corresponding interrupt handling vector. Alterna-tively, OCF4A is cleared by writing a logic one to the flag. When the I-bit in SREG, and OCIE4A (Timer/Counter4 Compare match InterruptA Enable), and the OCF4A are set (one), the Timer/Counter4 Compare A match Interrupt is executed. RW 0 TOV4 Timer/Counter4 Overflow Flag The TOV4 is set (one) when an overflow occurs in Timer/Counter4. TOV4 is cleared by hardware when executing the cor-responding interrupt handling vector. Alternatively, TOV4 is cleared by writing a logic one to the flag. When the I-bit in SREG, and TOIE4 (Timer/Counter4 Overflow Interrupt Enable), and TOV4 are set (one), the Timer/Counter4 Overflow Interrupt is executed. In PWM mode, this bit is set when Timer/Counter4 changes counting direction at $0000. RW 0 [TIMSK3:TIFR3:TCCR3A:TCCR3B:TCCR3C:TCNT3H:TCNT3L:OCR3AH:OCR3AL:OCR3BH:OCR3BL:ICR3H:ICR3L:OCR3CH:OCR3CL] [TCNT3H:TCNT3L];[OCR3AH:OCR3AL];[OCR3BH:OCR3BL];[OCR3CH:OCR3CL];[ICR3H:ICR3L] io_timer.bmp t16pwm3_03.xml TCCR3A Timer/Counter3 Control Register A NA $90 io_flag.bmp Y COM3A1 Compare Output Mode 1A, bit 1 The COM3A1 and COM3A0 control bits determine any output pin action following a compare match in Timer/Counter3. Any output pin actions affect pin OC3A - Output CompareA. This is an alternative function to an I/O port, and the corresponding direction control bit must be set (one) to control an output pin. The control configuration is shown in Table 10. RW 0 COM3A0 Compare Output Mode 3A, bit 0 The COM3A1 and COM3A0 control bits determine any output pin action following a compare match in Timer/Counter3. Any output pin actions affect pin OC3A - Output CompareA. This is an alternative function to an I/O port, and the corresponding direction control bit must be set (one) to control an output pin. The control configuration is shown in Table 10. RW 0 COM3B1 Compare Output Mode 3B, bit 1 The COM3B1 and COM3B0 control bits determine any output pin action following a compare match in Timer/Counter3. Any output pin actions affect pin OC3B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 COM3B0 Compare Output Mode 3B, bit 0 The COM3B1 and COM3B0 control bits determine any output pin action following a compare match in Timer/Counter3. Any output pin actions affect pin OC3B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 COM3C1 Compare Output Mode 3C, bit 1 The COM3C1 and COM3C0 control bits determine any output pin action following a compare match in Timer/Counter3. Any output pin actions affect pin OC3B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 COM3C0 Compare Output Mode 3C, bit 0 The COM3C1 and COM3C0 control bits determine any output pin action following a compare match in Timer/Counter3. Any output pin actions affect pin OC3B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 WGM31 Waveform Generation Mode Combined with the WGM33:2 bits found in the TCCR3B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 WGM30 Waveform Generation Mode Combined with the WGM33:2 bits found in the TCCR3B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 TCCR3B Timer/Counter3 Control Register B NA $91 io_flag.bmp Y ICNC3 Input Capture 3 Noise Canceler When the ICNC3 bit is cleared (zero), the input capture trigger noise canceler function is disabled. The input capture is triggered at the first rising/falling edge sampled on the ICP - input capture pin - as specified. When the ICNC3 bit is set (one), four successive samples are measures on the ICP - input capture pin, and all samples must be high/low according to the input capture trigger specification in the ICES3 bit. The actual sampling frequency is XTAL clock frequency. RW 0 ICES3 Input Capture 3 Edge Select While the ICES3 bit is cleared (zero), the Timer/Counter3 contents are transferred to the Input Capture Register - ICR3 - on the falling edge of the input capture pin - ICP. While the ICES3 bit is set (one), the Timer/Counter3 contents are transferred to the Input Capture Register - ICR3 - on the rising edge of the input capture pin - ICP. RW 0 WGM33 Waveform Generation Mode Combined with the WGM33:2 bits found in the TCCR3B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 WGM32 Waveform Generation Mode Combined with the WGM33:2 bits found in the TCCR3B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 CS32 Prescaler source of Timer/Counter 3 Select Prescaling Clock Source of Timer/Counter3. (0:0:0) = Stop. (0:0:1) = CK. (0:1:0) = CK / 8. (0:1:1) = CK / 64. (1:0:0) = CK / 256. (1:0:1) = CK / 1024. (1:1:0) = External Pin T3, falling edge. (1:1:1) = External Pin 1, rising edge. RW 0 CS31 Prescaler source of Timer/Counter 3 Select Prescaling Clock Source of Timer/Counter3. (0:0:0) = Stop. (0:0:1) = CK. (0:1:0) = CK / 8. (0:1:1) = CK / 64. (1:0:0) = CK / 256. (1:0:1) = CK / 1024. (1:1:0) = External Pin T3, falling edge. (1:1:1) = External Pin 1, rising edge. RW 0 CS30 Prescaler source of Timer/Counter 3 Select Prescaling Clock Source of Timer/Counter3. (0:0:0) = Stop. (0:0:1) = CK. (0:1:0) = CK / 8. (0:1:1) = CK / 64. (1:0:0) = CK / 256. (1:0:1) = CK / 1024. (1:1:0) = External Pin T1, falling edge. (1:1:1) = External Pin 1, rising edge. RW 0 TCCR3C Timer/Counter 3 Control Register C NA $92 io_flag.bmp Y FOC3A Force Output Compare 3A Writing a logical one to this bit, forces a change in the compare match output pin PD5 according to the values already set in COM3A1 and COM3A0.If the COM3A1 and COM3A0 bits are written in the same cycle as FOC3A,the new settings will not take effect until next compare match or forced compare match occurs. The Force Output Compare bit can be used to change the output pin without waiting for a compare match in the timer. The automatic action programmed in COM3A1 and COM3A0 happens as if a Compare Match had occurred, but no interrupt is generated and it will not clear the timer even if CTC3 in TCCR3B is set. The corresponding I/O pin must be set as an output pin for the FOC3A bit to have effect on the pin. The FOC3A bit will always be read as zero. The setting of the FOC3A bit has no effect in PWM m RW 0 FOC3B Force Output Compare 3B Writing a logical one to this bit, forces a change in the compare match output pin PD4 according to the values already set in COM3B1 and COM3B0.If the COM3B1 and COM3B0 bits are written in the same cycle as FOC3B,the new settings will not take effect until next compare match or forced compare match occurs. The Force Output Compare bit can be used to change the output pin without waiting for a compare match in the timer. The automatic action programmed in COM3B1 and COM3B0 happens as if a Compare Match had occurred, but no interrupt is generated. The corresponding I/O pin must be set as an output pin for the FOC3B bit to have effect on the pin. The FOC3B bit will always be read as zero. The setting of the FOC3B bit has no effect in PWM mo RW 0 FOC3C Force Output Compare 3C Writing a logical one to this bit, forces a change in the compare match output pin PD4 according to the values already set in COM3B1 and COM3B0.If the COM3B1 and COM3B0 bits are written in the same cycle as FOC3B,the new settings will not take effect until next compare match or forced compare match occurs. The Force Output Compare bit can be used to change the output pin without waiting for a compare match in the timer. The automatic action programmed in COM3B1 and COM3B0 happens as if a Compare Match had occurred, but no interrupt is generated. The corresponding I/O pin must be set as an output pin for the FOC3B bit to have effect on the pin. The FOC3B bit will always be read as zero. The setting of the FOC3B bit has no effect in PWM mo RW 0 TCNT3H Timer/Counter3 High Byte This 16-bit register contains the prescaled value of the 16-bit Timer/Counter3. To ensure that both the high and low bytes are read and written simultaneously when the CPU accesses these registers, the access is performed using an 8-bit temporary register (TEMP). This temporary register is also used when accessing OCR3A, OCR3B and ICR3. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt rou NA $95 io_timer.bmp N TCNT3H7 Timer/Counter3 High Byte bit 7 RW 0 TCNT3H6 Timer/Counter3 High Byte bit 6 RW 0 TCNT3H5 Timer/Counter3 High Byte bit 5 RW 0 TCNT3H4 Timer/Counter3 High Byte bit 4 RW 0 TCNT3H3 Timer/Counter3 High Byte bit 3 RW 0 TCNT3H2 Timer/Counter3 High Byte bit 2 RW 0 TCNT3H1 Timer/Counter3 High Byte bit 1 RW 0 TCNT3H0 Timer/Counter3 High Byte bit 0 RW 0 TCNT3L Timer/Counter3 Low Byte This 16-bit register contains the prescaled value of the 16-bit Timer/Counter3. To ensure that both the high and low bytes are read and written simultaneously when the CPU accesses these registers, the access is performed using an 8-bit temporary register (TEMP). This temporary register is also used when accessing OCR3A, OCR3B and ICR3. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interru NA $94 io_timer.bmp N TCNT3L7 Timer/Counter3 Low Byte bit 7 RW 0 TCNT3L6 Timer/Counter3 Low Byte bit 6 RW 0 TCNT3L5 Timer/Counter3 Low Byte bit 5 RW 0 TCNT3L4 Timer/Counter3 Low Byte bit 4 RW 0 TCNT3L3 Timer/Counter3 Low Byte bit 3 RW 0 TCNT3L2 Timer/Counter3 Low Byte bit 2 RW 0 TCNT3L1 Timer/Counter3 Low Byte bit 1 RW 0 TCNT3L0 Timer/Counter3 Low Byte bit 0 RW 0 OCR3AH Timer/Counter3 Outbut Compare Register A High Byte The output compare registers are 16-bit read/write registers. The Timer/Counter3 Output Compare Registers contain the data to be continuously compared with Timer/Counter3. Actions on compare matches are specified in the Timer/Counter3 Control and Status register.A compare match does only occur if Timer/Counter3 counts to the OCR value. A software write that sets TCNT3 and OCR3A or OCR3B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR3A and OCR3B - are 16-bit registers, a temporary register TEMP is used when OCR3A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR3AH or OCR3BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR3AL or OCR3BL, the TEMP register is simultaneously written to OCR3AH or OCR3BH. Consequently, the high byte OCR3AH or OCR3BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT3, and ICR3. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interr NA $99 io_timer.bmp N OCR3AH7 Timer/Counter3 Outbut Compare Register High Byte bit 7 RW 0 OCR3AH6 Timer/Counter3 Outbut Compare Register High Byte bit 6 RW 0 OCR3AH5 Timer/Counter3 Outbut Compare Register High Byte bit 5 RW 0 OCR3AH4 Timer/Counter3 Outbut Compare Register High Byte bit 4 RW 0 OCR3AH3 Timer/Counter3 Outbut Compare Register High Byte bit 3 RW 0 OCR3AH2 Timer/Counter3 Outbut Compare Register High Byte bit 2 RW 0 OCR3AH1 Timer/Counter3 Outbut Compare Register High Byte bit 1 RW 0 OCR3AH0 Timer/Counter3 Outbut Compare Register High Byte bit 0 RW 0 OCR3AL Timer/Counter3 Outbut Compare Register A Low Byte The output compare registers are 16-bit read/write registers. The Timer/Counter3 Output Compare Registers contain the data to be continuously compared with Timer/Counter3. Actions on compare matches are specified in the Timer/Counter3 Control and Status register.A compare match does only occur if Timer/Counter3 counts to the OCR value. A software write that sets TCNT3 and OCR3A or OCR3B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR3A and OCR3B - are 16-bit registers, a temporary register TEMP is used when OCR3A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR3AH or OCR3BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR3AL or OCR3BL, the TEMP register is simultaneously written to OCR3AH or OCR3BH. Consequently, the high byte OCR3AH or OCR3BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT3, and ICR3. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interru NA $98 io_timer.bmp N OCR3AL7 Timer/Counter3 Outbut Compare Register Low Byte Bit 7 RW 0 OCR3AL6 Timer/Counter3 Outbut Compare Register Low Byte Bit 6 RW 0 OCR3AL5 Timer/Counter3 Outbut Compare Register Low Byte Bit 5 RW 0 OCR3AL4 Timer/Counter3 Outbut Compare Register Low Byte Bit 4 RW 0 OCR3AL3 Timer/Counter3 Outbut Compare Register Low Byte Bit 3 RW 0 OCR3AL2 Timer/Counter3 Outbut Compare Register Low Byte Bit 2 RW 0 OCR3AL1 Timer/Counter3 Outbut Compare Register Low Byte Bit 1 RW 0 OCR3AL0 Timer/Counter3 Outbut Compare Register Low Byte Bit 0 RW 0 OCR3BH Timer/Counter3 Output Compare Register B High Byte The output compare registers are 16-bit read/write registers. The Timer/Counter3 Output Compare Registers contain the data to be continuously compared with Timer/Counter3. Actions on compare matches are specified in the Timer/Counter3 Control and Status register.A compare match does only occur if Timer/Counter3 counts to the OCR value. A software write that sets TCNT3 and OCR3A or OCR3B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR3A and OCR3B - are 16-bit registers, a temporary register TEMP is used when OCR3A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR3AH or OCR3BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR3AL or OCR3BL, the TEMP register is simultaneously written to OCR3AH or OCR3BH. Consequently, the high byte OCR3AH or OCR3BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT3, and ICR3. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt r NA $9B io_timer.bmp N OCR3BH7 Timer/Counter3 Output Compare Register High Byte bit 7 RW 0 OCR3BH6 Timer/Counter3 Output Compare Register High Byte bit 6 RW 0 OCR3BH5 Timer/Counter3 Output Compare Register High Byte bit 5 RW 0 OCR3BH4 Timer/Counter3 Output Compare Register High Byte bit 4 RW 0 OCR3BH3 Timer/Counter3 Output Compare Register High Byte bit 3 RW 0 OCR3BH2 Timer/Counter3 Output Compare Register High Byte bit 2 RW 0 OCR3BH1 Timer/Counter3 Output Compare Register High Byte bit 1 RW 0 OCR3BH0 Timer/Counter3 Output Compare Register High Byte bit 0 RW 0 OCR3BL Timer/Counter3 Output Compare Register B Low Byte The output compare registers are 16-bit read/write registers. The Timer/Counter3 Output Compare Registers contain the data to be continuously compared with Timer/Counter3. Actions on compare matches are specified in the Timer/Counter3 Control and Status register.A compare match does only occur if Timer/Counter3 counts to the OCR value. A software write that sets TCNT3 and OCR3A or OCR3B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR3A and OCR3B - are 16-bit registers, a temporary register TEMP is used when OCR3A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR3AH or OCR3BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR3AL or OCR3BL, the TEMP register is simultaneously written to OCR3AH or OCR3BH. Consequently, the high byte OCR3AH or OCR3BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT3, and ICR3. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt rout NA $9A io_timer.bmp N OCR3BL7 Timer/Counter3 Output Compare Register Low Byte bit 7 R 0 OCR3BL6 Timer/Counter3 Output Compare Register Low Byte bit 6 RW 0 OCR3BL5 Timer/Counter3 Output Compare Register Low Byte bit 5 RW 0 OCR3BL4 Timer/Counter3 Output Compare Register Low Byte bit 4 RW 0 OCR3BL3 Timer/Counter3 Output Compare Register Low Byte bit 3 RW 0 OCR3BL2 Timer/Counter3 Output Compare Register Low Byte bit 2 RW 0 OCR3BL1 Timer/Counter3 Output Compare Register Low Byte bit 1 RW 0 OCR3BL0 Timer/Counter3 Output Compare Register Low Byte bit 0 RW 0 OCR3CH Timer/Counter3 Output Compare Register B High Byte The output compare registers are 16-bit read/write registers. The Timer/Counter3 Output Compare Registers contain the data to be continuously compared with Timer/Counter3. Actions on compare matches are specified in the Timer/Counter3 Control and Status register.A compare match does only occur if Timer/Counter3 counts to the OCR value. A software write that sets TCNT3 and OCR3A or OCR3B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR3A and OCR3B - are 16-bit registers, a temporary register TEMP is used when OCR3A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR3AH or OCR3BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR3AL or OCR3BL, the TEMP register is simultaneously written to OCR3AH or OCR3BH. Consequently, the high byte OCR3AH or OCR3BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT3, and ICR3. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt r NA $9D io_timer.bmp N OCR3CH7 Timer/Counter3 Output Compare Register High Byte bit 7 RW 0 OCR3CH6 Timer/Counter3 Output Compare Register High Byte bit 6 RW 0 OCR3CH5 Timer/Counter3 Output Compare Register High Byte bit 5 RW 0 OCR3CH4 Timer/Counter3 Output Compare Register High Byte bit 4 RW 0 OCR3CH3 Timer/Counter3 Output Compare Register High Byte bit 3 RW 0 OCR3CH2 Timer/Counter3 Output Compare Register High Byte bit 2 RW 0 OCR3CH1 Timer/Counter3 Output Compare Register High Byte bit 1 RW 0 OCR3CH0 Timer/Counter3 Output Compare Register High Byte bit 0 RW 0 OCR3CL Timer/Counter3 Output Compare Register B Low Byte The output compare registers are 16-bit read/write registers. The Timer/Counter3 Output Compare Registers contain the data to be continuously compared with Timer/Counter3. Actions on compare matches are specified in the Timer/Counter3 Control and Status register.A compare match does only occur if Timer/Counter3 counts to the OCR value. A software write that sets TCNT3 and OCR3A or OCR3B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR3A and OCR3B - are 16-bit registers, a temporary register TEMP is used when OCR3A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR3AH or OCR3BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR3AL or OCR3BL, the TEMP register is simultaneously written to OCR3AH or OCR3BH. Consequently, the high byte OCR3AH or OCR3BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT3, and ICR3. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt rout NA $9C io_timer.bmp N OCR3CL7 Timer/Counter3 Output Compare Register Low Byte bit 7 R 0 OCR3CL6 Timer/Counter3 Output Compare Register Low Byte bit 6 RW 0 OCR3CL5 Timer/Counter3 Output Compare Register Low Byte bit 5 RW 0 OCR3CL4 Timer/Counter3 Output Compare Register Low Byte bit 4 RW 0 OCR3CL3 Timer/Counter3 Output Compare Register Low Byte bit 3 RW 0 OCR3CL2 Timer/Counter3 Output Compare Register Low Byte bit 2 RW 0 OCR3CL1 Timer/Counter3 Output Compare Register Low Byte bit 1 RW 0 OCR3CL0 Timer/Counter3 Output Compare Register Low Byte bit 0 RW 0 ICR3H Timer/Counter3 Input Capture Register High Byte The input capture register is a 16-bit read-only register. When the rising or falling edge (according to the input capture edge setting - ICES3) of the signal at the input capture pin -ICP - is detected, the current value of the Timer/Counter3 is transferred to the Input Capture Register - ICR3. At the same time, the input capture flag - ICF3 - is set (one). Since the Input Capture Register - ICR3 - is a 16-bit register, a temporary register TEMP is used when ICR3 is read to ensure that both bytes are read simultaneously. When the CPU reads the low byte ICR3L, the data is sent to the CPU and the data of the high byte ICR3H is placed in the TEMP register. When the CPU reads the data in the high byte ICR3H, the CPU receives the data in the TEMP register. Consequently, the low byte ICR3L must be accessed first for a full 16-bit register read operation. The TEMP register is also used when accessing TCNT3, OCR3A and OCR3B. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt NA $97 io_timer.bmp N ICR3H7 Timer/Counter3 Input Capture Register High Byte bit 7 RW 0 ICR3H6 Timer/Counter3 Input Capture Register High Byte bit 6 R 0 ICR3H5 Timer/Counter3 Input Capture Register High Byte bit 5 R 0 ICR3H4 Timer/Counter3 Input Capture Register High Byte bit 4 R 0 ICR3H3 Timer/Counter3 Input Capture Register High Byte bit 3 R 0 ICR3H2 Timer/Counter3 Input Capture Register High Byte bit 2 R 0 ICR3H1 Timer/Counter3 Input Capture Register High Byte bit 1 R 0 ICR3H0 Timer/Counter3 Input Capture Register High Byte bit 0 R 0 ICR3L Timer/Counter3 Input Capture Register Low Byte The input capture register is a 16-bit read-only register. When the rising or falling edge (according to the input capture edge setting - ICES3) of the signal at the input capture pin -ICP - is detected, the current value of the Timer/Counter3 is transferred to the Input Capture Register - ICR3. At the same time, the input capture flag - ICF3 - is set (one). Since the Input Capture Register - ICR3 - is a 16-bit register, a temporary register TEMP is used when ICR3 is read to ensure that both bytes are read simultaneously. When the CPU reads the low byte ICR3L, the data is sent to the CPU and the data of the high byte ICR3H is placed in the TEMP register. When the CPU reads the data in the high byte ICR3H, the CPU receives the data in the TEMP register. Consequently, the low byte ICR3L must be accessed first for a full 16-bit register read operation. The TEMP register is also used when accessing TCNT3, OCR3A and OCR3B. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within inter NA $96 io_timer.bmp N ICR3L7 Timer/Counter3 Input Capture Register Low Byte bit 7 R 0 ICR3L6 Timer/Counter3 Input Capture Register Low Byte bit 6 R 0 ICR3L5 Timer/Counter3 Input Capture Register Low Byte bit 5 R 0 ICR3L4 Timer/Counter3 Input Capture Register Low Byte bit 4 R 0 ICR3L3 Timer/Counter3 Input Capture Register Low Byte bit 3 R 0 ICR3L2 Timer/Counter3 Input Capture Register Low Byte bit 2 R 0 ICR3L1 Timer/Counter3 Input Capture Register Low Byte bit 1 R 0 ICR3L0 Timer/Counter3 Input Capture Register Low Byte bit 0 R 0 TIMSK3 Timer/Counter3 Interrupt Mask Register NA $71 io_flag.bmp Y ICIE3 Timer/Counter3 Input Capture Interrupt Enable When the TICIE3 bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter3 Input Capture Event Interrupt is enabled. The corresponding interrupt (at vector $003) is executed if a capture-triggering event occurs on pin 31, ICP, i.e., when the ICF3 bit is set in the Timer/Counter Interrupt Flag Register - TIFR. RW 0 OCIE3C Timer/Counter3 Output Compare C Match Interrupt Enable When the OCIE3C bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter3 CompareB Match interrupt is enabled. The corresponding interrupt (at vector $005) is executed if a CompareB match in Timer/Counter3 occurs, i.e., when the OCF3B bit is set in the Timer/Counter Interrupt Flag Register - TIFR. R 0 OCIE3B Timer/Counter3 Output Compare B Match Interrupt Enable When the OCIE3B bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter3 CompareB Match interrupt is enabled. The corresponding interrupt (at vector $005) is executed if a CompareB match in Timer/Counter3 occurs, i.e., when the OCF3B bit is set in the Timer/Counter Interrupt Flag Register - TIFR. R 0 OCIE3A Timer/Counter3 Output Compare A Match Interrupt Enable When the OCIE3A bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter3 CompareA Match interrupt is enabled. The corresponding interrupt (at vector $004) is executed if a CompareA match in Timer/Counter3 occurs, i.e., when the OCF3A bit is set in the Timer/Counter Interrupt Flag Register - TIFR. RW 0 TOIE3 Timer/Counter3 Overflow Interrupt Enable When the TOIE3 bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter3 Overflow interrupt is enabled. The corresponding interrupt (at vector $006) is executed if an overflow in Timer/Counter3 occurs, i.e., when the TOV3 bit is set in the Timer/Counter Interrupt Flag Register - TIFR. RW 0 TIFR3 Timer/Counter3 Interrupt Flag register $18 $38 io_flag.bmp Y ICF3 Input Capture Flag 3 The ICF3 bit is set (one) to flag an input capture event, indicating that the Timer/Counter3 value has been transferred to the input capture register - ICR3. ICF3 is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, ICF3 is cleared by writing a logic one to the flag. When the SREG I-bit, and TICIE3 (Timer/Counter3 Input Capture Interrupt Enable), and ICF3 are set (one), the Timer/Counter3 Capture Interrupt is executed. RW 0 OCF3C Output Compare Flag 3C The OCF3C bit is set (one) when compare match occurs between the Timer/Counter3 and the data in OCR3B - Output Compare Register 3B. OCF3B is cleared by hardware when executing the corresponding interrupt handling vector. Alterna-tively, OCF3B is cleared by writing a logic one to the flag. When the I-bit in SREG, and OCIE3B (Timer/Counter3 Compare match InterruptB Enable), and the OCF3B are set (one), the Timer/Counter3 Compare B match Interrupt is executed. RW 0 OCF3B Output Compare Flag 3B The OCF3B bit is set (one) when compare match occurs between the Timer/Counter3 and the data in OCR3B - Output Compare Register 3B. OCF3B is cleared by hardware when executing the corresponding interrupt handling vector. Alterna-tively, OCF3B is cleared by writing a logic one to the flag. When the I-bit in SREG, and OCIE3B (Timer/Counter3 Compare match InterruptB Enable), and the OCF3B are set (one), the Timer/Counter3 Compare B match Interrupt is executed. RW 0 OCF3A Output Compare Flag 3A The OCF3A bit is set (one) when compare match occurs between the Timer/Counter3 and the data in OCR3A - Output Compare Register 3A. OCF3A is cleared by hardware when executing the corresponding interrupt handling vector. Alterna-tively, OCF3A is cleared by writing a logic one to the flag. When the I-bit in SREG, and OCIE3A (Timer/Counter3 Compare match InterruptA Enable), and the OCF3A are set (one), the Timer/Counter3 Compare A match Interrupt is executed. RW 0 TOV3 Timer/Counter3 Overflow Flag The TOV3 is set (one) when an overflow occurs in Timer/Counter3. TOV3 is cleared by hardware when executing the cor-responding interrupt handling vector. Alternatively, TOV3 is cleared by writing a logic one to the flag. When the I-bit in SREG, and TOIE3 (Timer/Counter3 Overflow Interrupt Enable), and TOV3 are set (one), the Timer/Counter3 Overflow Interrupt is executed. In PWM mode, this bit is set when Timer/Counter3 changes counting direction at $0000. RW 0 [TIMSK1:TIFR1:TCCR1A:TCCR1B:TCCR1C:TCNT1H:TCNT1L:OCR1AH:OCR1AL:OCR1BH:OCR1BL:ICR1H:ICR1L:OCR1CH:OCR1CL] [TCNT1H:TCNT1L];[OCR1AH:OCR1AL];[OCR1BH:OCR1BL];[OCR1CH:OCR1CL];[ICR1H:ICR1L] io_timer.bmp t16pwm1_14.xml TCCR1A Timer/Counter1 Control Register A NA $80 io_flag.bmp Y COM1A1 Compare Output Mode 1A, bit 1 The COM1A1 and COM1A0 control bits determine any output pin action following a compare match in Timer/Counter1. Any output pin actions affect pin OC1A - Output CompareA. This is an alternative function to an I/O port, and the corresponding direction control bit must be set (one) to control an output pin. The control configuration is shown in Table 10. RW 0 COM1A0 Compare Output Mode 1A, bit 0 The COM1A1 and COM1A0 control bits determine any output pin action following a compare match in Timer/Counter1. Any output pin actions affect pin OC1A - Output CompareA. This is an alternative function to an I/O port, and the corresponding direction control bit must be set (one) to control an output pin. The control configuration is shown in Table 10. RW 0 COM1B1 Compare Output Mode 1B, bit 1 The COM1B1 and COM1B0 control bits determine any output pin action following a compare match in Timer/Counter1. Any output pin actions affect pin OC1B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 COM1B0 Compare Output Mode 1B, bit 0 The COM1B1 and COM1B0 control bits determine any output pin action following a compare match in Timer/Counter1. Any output pin actions affect pin OC1B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 COM1C1 Compare Output Mode 1C, bit 1 The COM1C1 and COM1C0 control bits determine any output pin action following a compare match in Timer/Counter1. Any output pin actions affect pin OC1B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 COM1C0 Compare Output Mode 1C, bit 0 The COM1C1 and COM1C0 control bits determine any output pin action following a compare match in Timer/Counter1. Any output pin actions affect pin OC1B - Output CompareB. This is an alternative function to an I/O port, and the corre-sponding direction control bit must be set (one) to control an output pin. RW 0 WGM11 Waveform Generation Mode Combined with the WGM13:2 bits found in the TCCR1B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 WGM10 Waveform Generation Mode Combined with the WGM13:2 bits found in the TCCR1B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 TCCR1B Timer/Counter1 Control Register B NA $81 io_flag.bmp Y ICNC1 Input Capture 1 Noise Canceler When the ICNC1 bit is cleared (zero), the input capture trigger noise canceler function is disabled. The input capture is triggered at the first rising/falling edge sampled on the ICP - input capture pin - as specified. When the ICNC1 bit is set (one), four successive samples are measures on the ICP - input capture pin, and all samples must be high/low according to the input capture trigger specification in the ICES1 bit. The actual sampling frequency is XTAL clock frequency. RW 0 ICES1 Input Capture 1 Edge Select While the ICES1 bit is cleared (zero), the Timer/Counter1 contents are transferred to the Input Capture Register - ICR1 - on the falling edge of the input capture pin - ICP. While the ICES1 bit is set (one), the Timer/Counter1 contents are transferred to the Input Capture Register - ICR1 - on the rising edge of the input capture pin - ICP. RW 0 WGM13 Waveform Generation Mode Combined with the WGM13:2 bits found in the TCCR1B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 WGM12 Waveform Generation Mode Combined with the WGM13:2 bits found in the TCCR1B register,these bits control the counting sequence of the counter, the source for maximum (TOP)counter value,and what type of waveform generation to be used.Modes of operation supported by the timer/counter unit are:Normal mode (counter),Clear Timer on Compare match (CTC)mode,and three types of Pulse Width Modulation (PWM)modes. PLease refer to the manual for a Mode Bit Description Table. RW 0 CS12 Prescaler source of Timer/Counter 1 Select Prescaling Clock Source of Timer/Counter1. (0:0:0) = Stop. (0:0:1) = CK. (0:1:0) = CK / 8. (0:1:1) = CK / 64. (1:0:0) = CK / 256. (1:0:1) = CK / 1024. (1:1:0) = External Pin T1, falling edge. (1:1:1) = External Pin 1, rising edge. RW 0 CS11 Prescaler source of Timer/Counter 1 Select Prescaling Clock Source of Timer/Counter1. (0:0:0) = Stop. (0:0:1) = CK. (0:1:0) = CK / 8. (0:1:1) = CK / 64. (1:0:0) = CK / 256. (1:0:1) = CK / 1024. (1:1:0) = External Pin T1, falling edge. (1:1:1) = External Pin 1, rising edge. RW 0 CS10 Prescaler source of Timer/Counter 1 Select Prescaling Clock Source of Timer/Counter1. (0:0:0) = Stop. (0:0:1) = CK. (0:1:0) = CK / 8. (0:1:1) = CK / 64. (1:0:0) = CK / 256. (1:0:1) = CK / 1024. (1:1:0) = External Pin T1, falling edge. (1:1:1) = External Pin 1, rising edge. RW 0 TCCR1C Timer/Counter 1 Control Register C NA $82 io_flag.bmp Y FOC1A Force Output Compare 1A Writing a logical one to this bit, forces a change in the compare match output pin PD5 according to the values already set in COM1A1 and COM1A0.If the COM1A1 and COM1A0 bits are written in the same cycle as FOC1A,the new settings will not take effect until next compare match or forced compare match occurs. The Force Output Compare bit can be used to change the output pin without waiting for a compare match in the timer. The automatic action programmed in COM1A1 and COM1A0 happens as if a Compare Match had occurred, but no interrupt is generated and it will not clear the timer even if CTC1 in TCCR1B is set. The corresponding I/O pin must be set as an output pin for the FOC1A bit to have effect on the pin. The FOC1A bit will always be read as zero. The setting of the FOC1A bit has no effect in PWM m RW 0 FOC1B Force Output Compare 1B Writing a logical one to this bit, forces a change in the compare match output pin PD4 according to the values already set in COM1B1 and COM1B0.If the COM1B1 and COM1B0 bits are written in the same cycle as FOC1B,the new settings will not take effect until next compare match or forced compare match occurs. The Force Output Compare bit can be used to change the output pin without waiting for a compare match in the timer. The automatic action programmed in COM1B1 and COM1B0 happens as if a Compare Match had occurred, but no interrupt is generated. The corresponding I/O pin must be set as an output pin for the FOC1B bit to have effect on the pin. The FOC1B bit will always be read as zero. The setting of the FOC1B bit has no effect in PWM mo RW 0 FOC1C Force Output Compare 1C Writing a logical one to this bit, forces a change in the compare match output pin PD4 according to the values already set in COM1B1 and COM1B0.If the COM1B1 and COM1B0 bits are written in the same cycle as FOC1B,the new settings will not take effect until next compare match or forced compare match occurs. The Force Output Compare bit can be used to change the output pin without waiting for a compare match in the timer. The automatic action programmed in COM1B1 and COM1B0 happens as if a Compare Match had occurred, but no interrupt is generated. The corresponding I/O pin must be set as an output pin for the FOC1B bit to have effect on the pin. The FOC1B bit will always be read as zero. The setting of the FOC1B bit has no effect in PWM mo RW 0 TCNT1H Timer/Counter1 High Byte This 16-bit register contains the prescaled value of the 16-bit Timer/Counter1. To ensure that both the high and low bytes are read and written simultaneously when the CPU accesses these registers, the access is performed using an 8-bit temporary register (TEMP). This temporary register is also used when accessing OCR1A, OCR1B and ICR1. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt rou NA $85 io_timer.bmp N TCNT1H7 Timer/Counter1 High Byte bit 7 RW 0 TCNT1H6 Timer/Counter1 High Byte bit 6 RW 0 TCNT1H5 Timer/Counter1 High Byte bit 5 RW 0 TCNT1H4 Timer/Counter1 High Byte bit 4 RW 0 TCNT1H3 Timer/Counter1 High Byte bit 3 RW 0 TCNT1H2 Timer/Counter1 High Byte bit 2 RW 0 TCNT1H1 Timer/Counter1 High Byte bit 1 RW 0 TCNT1H0 Timer/Counter1 High Byte bit 0 RW 0 TCNT1L Timer/Counter1 Low Byte This 16-bit register contains the prescaled value of the 16-bit Timer/Counter1. To ensure that both the high and low bytes are read and written simultaneously when the CPU accesses these registers, the access is performed using an 8-bit temporary register (TEMP). This temporary register is also used when accessing OCR1A, OCR1B and ICR1. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interru NA $84 io_timer.bmp N TCNT1L7 Timer/Counter1 Low Byte bit 7 RW 0 TCNT1L6 Timer/Counter1 Low Byte bit 6 RW 0 TCNT1L5 Timer/Counter1 Low Byte bit 5 RW 0 TCNT1L4 Timer/Counter1 Low Byte bit 4 RW 0 TCNT1L3 Timer/Counter1 Low Byte bit 3 RW 0 TCNT1L2 Timer/Counter1 Low Byte bit 2 RW 0 TCNT1L1 Timer/Counter1 Low Byte bit 1 RW 0 TCNT1L0 Timer/Counter1 Low Byte bit 0 RW 0 OCR1AH Timer/Counter1 Outbut Compare Register A High Byte The output compare registers are 16-bit read/write registers. The Timer/Counter1 Output Compare Registers contain the data to be continuously compared with Timer/Counter1. Actions on compare matches are specified in the Timer/Counter1 Control and Status register.A compare match does only occur if Timer/Counter1 counts to the OCR value. A software write that sets TCNT1 and OCR1A or OCR1B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR1A and OCR1B - are 16-bit registers, a temporary register TEMP is used when OCR1A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR1AH or OCR1BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR1AL or OCR1BL, the TEMP register is simultaneously written to OCR1AH or OCR1BH. Consequently, the high byte OCR1AH or OCR1BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT1, and ICR1. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interr NA $89 io_timer.bmp N OCR1AH7 Timer/Counter1 Outbut Compare Register High Byte bit 7 RW 0 OCR1AH6 Timer/Counter1 Outbut Compare Register High Byte bit 6 RW 0 OCR1AH5 Timer/Counter1 Outbut Compare Register High Byte bit 5 RW 0 OCR1AH4 Timer/Counter1 Outbut Compare Register High Byte bit 4 RW 0 OCR1AH3 Timer/Counter1 Outbut Compare Register High Byte bit 3 RW 0 OCR1AH2 Timer/Counter1 Outbut Compare Register High Byte bit 2 RW 0 OCR1AH1 Timer/Counter1 Outbut Compare Register High Byte bit 1 RW 0 OCR1AH0 Timer/Counter1 Outbut Compare Register High Byte bit 0 RW 0 OCR1AL Timer/Counter1 Outbut Compare Register A Low Byte The output compare registers are 16-bit read/write registers. The Timer/Counter1 Output Compare Registers contain the data to be continuously compared with Timer/Counter1. Actions on compare matches are specified in the Timer/Counter1 Control and Status register.A compare match does only occur if Timer/Counter1 counts to the OCR value. A software write that sets TCNT1 and OCR1A or OCR1B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR1A and OCR1B - are 16-bit registers, a temporary register TEMP is used when OCR1A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR1AH or OCR1BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR1AL or OCR1BL, the TEMP register is simultaneously written to OCR1AH or OCR1BH. Consequently, the high byte OCR1AH or OCR1BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT1, and ICR1. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interru NA $88 io_timer.bmp N OCR1AL7 Timer/Counter1 Outbut Compare Register Low Byte Bit 7 RW 0 OCR1AL6 Timer/Counter1 Outbut Compare Register Low Byte Bit 6 RW 0 OCR1AL5 Timer/Counter1 Outbut Compare Register Low Byte Bit 5 RW 0 OCR1AL4 Timer/Counter1 Outbut Compare Register Low Byte Bit 4 RW 0 OCR1AL3 Timer/Counter1 Outbut Compare Register Low Byte Bit 3 RW 0 OCR1AL2 Timer/Counter1 Outbut Compare Register Low Byte Bit 2 RW 0 OCR1AL1 Timer/Counter1 Outbut Compare Register Low Byte Bit 1 RW 0 OCR1AL0 Timer/Counter1 Outbut Compare Register Low Byte Bit 0 RW 0 OCR1BH Timer/Counter1 Output Compare Register B High Byte The output compare registers are 16-bit read/write registers. The Timer/Counter1 Output Compare Registers contain the data to be continuously compared with Timer/Counter1. Actions on compare matches are specified in the Timer/Counter1 Control and Status register.A compare match does only occur if Timer/Counter1 counts to the OCR value. A software write that sets TCNT1 and OCR1A or OCR1B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR1A and OCR1B - are 16-bit registers, a temporary register TEMP is used when OCR1A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR1AH or OCR1BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR1AL or OCR1BL, the TEMP register is simultaneously written to OCR1AH or OCR1BH. Consequently, the high byte OCR1AH or OCR1BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT1, and ICR1. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt r NA $8B io_timer.bmp N OCR1BH7 Timer/Counter1 Output Compare Register High Byte bit 7 RW 0 OCR1BH6 Timer/Counter1 Output Compare Register High Byte bit 6 RW 0 OCR1BH5 Timer/Counter1 Output Compare Register High Byte bit 5 RW 0 OCR1BH4 Timer/Counter1 Output Compare Register High Byte bit 4 RW 0 OCR1BH3 Timer/Counter1 Output Compare Register High Byte bit 3 RW 0 OCR1BH2 Timer/Counter1 Output Compare Register High Byte bit 2 RW 0 OCR1BH1 Timer/Counter1 Output Compare Register High Byte bit 1 RW 0 OCR1BH0 Timer/Counter1 Output Compare Register High Byte bit 0 RW 0 OCR1BL Timer/Counter1 Output Compare Register B Low Byte The output compare registers are 16-bit read/write registers. The Timer/Counter1 Output Compare Registers contain the data to be continuously compared with Timer/Counter1. Actions on compare matches are specified in the Timer/Counter1 Control and Status register.A compare match does only occur if Timer/Counter1 counts to the OCR value. A software write that sets TCNT1 and OCR1A or OCR1B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR1A and OCR1B - are 16-bit registers, a temporary register TEMP is used when OCR1A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR1AH or OCR1BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR1AL or OCR1BL, the TEMP register is simultaneously written to OCR1AH or OCR1BH. Consequently, the high byte OCR1AH or OCR1BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT1, and ICR1. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt rout NA $8A io_timer.bmp N OCR1BL7 Timer/Counter1 Output Compare Register Low Byte bit 7 R 0 OCR1BL6 Timer/Counter1 Output Compare Register Low Byte bit 6 RW 0 OCR1BL5 Timer/Counter1 Output Compare Register Low Byte bit 5 RW 0 OCR1BL4 Timer/Counter1 Output Compare Register Low Byte bit 4 RW 0 OCR1BL3 Timer/Counter1 Output Compare Register Low Byte bit 3 RW 0 OCR1BL2 Timer/Counter1 Output Compare Register Low Byte bit 2 RW 0 OCR1BL1 Timer/Counter1 Output Compare Register Low Byte bit 1 RW 0 OCR1BL0 Timer/Counter1 Output Compare Register Low Byte bit 0 RW 0 OCR1CH Timer/Counter1 Output Compare Register B High Byte The output compare registers are 16-bit read/write registers. The Timer/Counter1 Output Compare Registers contain the data to be continuously compared with Timer/Counter1. Actions on compare matches are specified in the Timer/Counter1 Control and Status register.A compare match does only occur if Timer/Counter1 counts to the OCR value. A software write that sets TCNT1 and OCR1A or OCR1B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR1A and OCR1B - are 16-bit registers, a temporary register TEMP is used when OCR1A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR1AH or OCR1BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR1AL or OCR1BL, the TEMP register is simultaneously written to OCR1AH or OCR1BH. Consequently, the high byte OCR1AH or OCR1BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT1, and ICR1. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt r NA $8D io_timer.bmp N OCR1CH7 Timer/Counter1 Output Compare Register High Byte bit 7 RW 0 OCR1CH6 Timer/Counter1 Output Compare Register High Byte bit 6 RW 0 OCR1CH5 Timer/Counter1 Output Compare Register High Byte bit 5 RW 0 OCR1CH4 Timer/Counter1 Output Compare Register High Byte bit 4 RW 0 OCR1CH3 Timer/Counter1 Output Compare Register High Byte bit 3 RW 0 OCR1CH2 Timer/Counter1 Output Compare Register High Byte bit 2 RW 0 OCR1CH1 Timer/Counter1 Output Compare Register High Byte bit 1 RW 0 OCR1CH0 Timer/Counter1 Output Compare Register High Byte bit 0 RW 0 OCR1CL Timer/Counter1 Output Compare Register B Low Byte The output compare registers are 16-bit read/write registers. The Timer/Counter1 Output Compare Registers contain the data to be continuously compared with Timer/Counter1. Actions on compare matches are specified in the Timer/Counter1 Control and Status register.A compare match does only occur if Timer/Counter1 counts to the OCR value. A software write that sets TCNT1 and OCR1A or OCR1B to the same value does not generate a compare match. A compare match will set the compare interrupt flag in the CPU clock cycle following the compare event. Since the Output Compare Registers - OCR1A and OCR1B - are 16-bit registers, a temporary register TEMP is used when OCR1A/B are written to ensure that both bytes are updated simultaneously. When the CPU writes the high byte, OCR1AH or OCR1BH, the data is temporarily stored in the TEMP register. When the CPU writes the low byte, OCR1AL or OCR1BL, the TEMP register is simultaneously written to OCR1AH or OCR1BH. Consequently, the high byte OCR1AH or OCR1BH must be written first for a full 16-bit register write operation. The TEMP register is also used when accessing TCNT1, and ICR1. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt rout NA $8C io_timer.bmp N OCR1CL7 Timer/Counter1 Output Compare Register Low Byte bit 7 R 0 OCR1CL6 Timer/Counter1 Output Compare Register Low Byte bit 6 RW 0 OCR1CL5 Timer/Counter1 Output Compare Register Low Byte bit 5 RW 0 OCR1CL4 Timer/Counter1 Output Compare Register Low Byte bit 4 RW 0 OCR1CL3 Timer/Counter1 Output Compare Register Low Byte bit 3 RW 0 OCR1CL2 Timer/Counter1 Output Compare Register Low Byte bit 2 RW 0 OCR1CL1 Timer/Counter1 Output Compare Register Low Byte bit 1 RW 0 OCR1CL0 Timer/Counter1 Output Compare Register Low Byte bit 0 RW 0 ICR1H Timer/Counter1 Input Capture Register High Byte The input capture register is a 16-bit read-only register. When the rising or falling edge (according to the input capture edge setting - ICES1) of the signal at the input capture pin -ICP - is detected, the current value of the Timer/Counter1 is transferred to the Input Capture Register - ICR1. At the same time, the input capture flag - ICF1 - is set (one). Since the Input Capture Register - ICR1 - is a 16-bit register, a temporary register TEMP is used when ICR1 is read to ensure that both bytes are read simultaneously. When the CPU reads the low byte ICR1L, the data is sent to the CPU and the data of the high byte ICR1H is placed in the TEMP register. When the CPU reads the data in the high byte ICR1H, the CPU receives the data in the TEMP register. Consequently, the low byte ICR1L must be accessed first for a full 16-bit register read operation. The TEMP register is also used when accessing TCNT1, OCR1A and OCR1B. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within interrupt NA $87 io_timer.bmp N ICR1H7 Timer/Counter1 Input Capture Register High Byte bit 7 RW 0 ICR1H6 Timer/Counter1 Input Capture Register High Byte bit 6 R 0 ICR1H5 Timer/Counter1 Input Capture Register High Byte bit 5 R 0 ICR1H4 Timer/Counter1 Input Capture Register High Byte bit 4 R 0 ICR1H3 Timer/Counter1 Input Capture Register High Byte bit 3 R 0 ICR1H2 Timer/Counter1 Input Capture Register High Byte bit 2 R 0 ICR1H1 Timer/Counter1 Input Capture Register High Byte bit 1 R 0 ICR1H0 Timer/Counter1 Input Capture Register High Byte bit 0 R 0 ICR1L Timer/Counter1 Input Capture Register Low Byte The input capture register is a 16-bit read-only register. When the rising or falling edge (according to the input capture edge setting - ICES1) of the signal at the input capture pin -ICP - is detected, the current value of the Timer/Counter1 is transferred to the Input Capture Register - ICR1. At the same time, the input capture flag - ICF1 - is set (one). Since the Input Capture Register - ICR1 - is a 16-bit register, a temporary register TEMP is used when ICR1 is read to ensure that both bytes are read simultaneously. When the CPU reads the low byte ICR1L, the data is sent to the CPU and the data of the high byte ICR1H is placed in the TEMP register. When the CPU reads the data in the high byte ICR1H, the CPU receives the data in the TEMP register. Consequently, the low byte ICR1L must be accessed first for a full 16-bit register read operation. The TEMP register is also used when accessing TCNT1, OCR1A and OCR1B. If the main program and also interrupt routines perform access to registers using TEMP, interrupts must be disabled during access from the main program (and from interrupt routines if interrupts are allowed from within inter NA $86 io_timer.bmp N ICR1L7 Timer/Counter1 Input Capture Register Low Byte bit 7 R 0 ICR1L6 Timer/Counter1 Input Capture Register Low Byte bit 6 R 0 ICR1L5 Timer/Counter1 Input Capture Register Low Byte bit 5 R 0 ICR1L4 Timer/Counter1 Input Capture Register Low Byte bit 4 R 0 ICR1L3 Timer/Counter1 Input Capture Register Low Byte bit 3 R 0 ICR1L2 Timer/Counter1 Input Capture Register Low Byte bit 2 R 0 ICR1L1 Timer/Counter1 Input Capture Register Low Byte bit 1 R 0 ICR1L0 Timer/Counter1 Input Capture Register Low Byte bit 0 R 0 TIMSK1 Timer/Counter1 Interrupt Mask Register NA $6F io_flag.bmp Y ICIE1 Timer/Counter1 Input Capture Interrupt Enable When the TICIE1 bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter1 Input Capture Event Interrupt is enabled. The corresponding interrupt (at vector $003) is executed if a capture-triggering event occurs on pin 31, ICP, i.e., when the ICF1 bit is set in the Timer/Counter Interrupt Flag Register - TIFR. RW 0 OCIE1C Timer/Counter1 Output Compare C Match Interrupt Enable When the OCIE1C bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter1 CompareB Match interrupt is enabled. The corresponding interrupt (at vector $005) is executed if a CompareB match in Timer/Counter1 occurs, i.e., when the OCF1B bit is set in the Timer/Counter Interrupt Flag Register - TIFR. R 0 OCIE1B Timer/Counter1 Output Compare B Match Interrupt Enable When the OCIE1B bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter1 CompareB Match interrupt is enabled. The corresponding interrupt (at vector $005) is executed if a CompareB match in Timer/Counter1 occurs, i.e., when the OCF1B bit is set in the Timer/Counter Interrupt Flag Register - TIFR. R 0 OCIE1A Timer/Counter1 Output Compare A Match Interrupt Enable When the OCIE1A bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter1 CompareA Match interrupt is enabled. The corresponding interrupt (at vector $004) is executed if a CompareA match in Timer/Counter1 occurs, i.e., when the OCF1A bit is set in the Timer/Counter Interrupt Flag Register - TIFR. RW 0 TOIE1 Timer/Counter1 Overflow Interrupt Enable When the TOIE1 bit is set (one) and the I-bit in the Status Register is set (one), the Timer/Counter1 Overflow interrupt is enabled. The corresponding interrupt (at vector $006) is executed if an overflow in Timer/Counter1 occurs, i.e., when the TOV1 bit is set in the Timer/Counter Interrupt Flag Register - TIFR. RW 0 TIFR1 Timer/Counter1 Interrupt Flag register $16 $36 io_flag.bmp Y ICF1 Input Capture Flag 1 The ICF1 bit is set (one) to flag an input capture event, indicating that the Timer/Counter1 value has been transferred to the input capture register - ICR1. ICF1 is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, ICF1 is cleared by writing a logic one to the flag. When the SREG I-bit, and TICIE1 (Timer/Counter1 Input Capture Interrupt Enable), and ICF1 are set (one), the Timer/Counter1 Capture Interrupt is executed. RW 0 OCF1C Output Compare Flag 1C The OCF1C bit is set (one) when compare match occurs between the Timer/Counter1 and the data in OCR1B - Output Compare Register 1B. OCF1B is cleared by hardware when executing the corresponding interrupt handling vector. Alterna-tively, OCF1B is cleared by writing a logic one to the flag. When the I-bit in SREG, and OCIE1B (Timer/Counter1 Compare match InterruptB Enable), and the OCF1B are set (one), the Timer/Counter1 Compare B match Interrupt is executed. RW 0 OCF1B Output Compare Flag 1B The OCF1B bit is set (one) when compare match occurs between the Timer/Counter1 and the data in OCR1B - Output Compare Register 1B. OCF1B is cleared by hardware when executing the corresponding interrupt handling vector. Alterna-tively, OCF1B is cleared by writing a logic one to the flag. When the I-bit in SREG, and OCIE1B (Timer/Counter1 Compare match InterruptB Enable), and the OCF1B are set (one), the Timer/Counter1 Compare B match Interrupt is executed. RW 0 OCF1A Output Compare Flag 1A The OCF1A bit is set (one) when compare match occurs between the Timer/Counter1 and the data in OCR1A - Output Compare Register 1A. OCF1A is cleared by hardware when executing the corresponding interrupt handling vector. Alterna-tively, OCF1A is cleared by writing a logic one to the flag. When the I-bit in SREG, and OCIE1A (Timer/Counter1 Compare match InterruptA Enable), and the OCF1A are set (one), the Timer/Counter1 Compare A match Interrupt is executed. RW 0 TOV1 Timer/Counter1 Overflow Flag The TOV1 is set (one) when an overflow occurs in Timer/Counter1. TOV1 is cleared by hardware when executing the cor-responding interrupt handling vector. Alternatively, TOV1 is cleared by writing a logic one to the flag. When the I-bit in SREG, and TOIE1 (Timer/Counter1 Overflow Interrupt Enable), and TOV1 are set (one), the Timer/Counter1 Overflow Interrupt is executed. In PWM mode, this bit is set when Timer/Counter1 changes counting direction at $0000. RW 0 [OCDR:MCUCR:MCUSR] io_com.bmp 00 JTAG Features: JTAG (IEEE std. 1149.1 compliant) Interface. Boundary-Scan Capabilities According to the IEEE std. 1149.1 (JTAG) Standard. Debugger Access to: – All Internal Peripheral Units – Internal and External RAM – The Internal Register File –Program Counter – EEPROM and Flash Memories. Extensive On-Chip Debug Support for Break Conditions, Including: –AVR Break Instruction – Break on Change of Program Memory Flow –Single Step Break –Program Memory Breakpoints on Single Address or Address Range – Data Memory Breakpoints on Single Address or Address Range. Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface. On-Chip Debugging Supported by AVR Stu OCDR On-Chip Debug Related Register in I/O Memory The OCDR register provides a communication channel from the running program in the microcontroller to the debugger. The CPU can transfer a byte to the debugger by writing to this location. At the same time, an internal flag; I/O Debug Reg-ister Dirty - IDRD - is set to indicate to the debugger that the register has been written. When the CPU reads the OCDR reg-ister the 7 LSB will be from the OCDR register, while the MSB is the IDRD bit. The debugger clears the IDRD bit when it has read the information. In some AVR devices, this register is shared with a standard I/O location. In this case, the OCDR register can only be accessed if the OCDEN fuse is programmed, and the debugger enables access to the OCDR register. In all other cases, the standard I/O location is accessed. Refer to the debugger documentation for further information on how to use this registe $31 $51 io_com.bmp N OCDR7 IDRD On-Chip Debug Register Bit 7 RW 0 OCDR6 On-Chip Debug Register Bit 6 RW 0 OCDR5 On-Chip Debug Register Bit 5 RW 0 OCDR4 On-Chip Debug Register Bit 4 RW 0 OCDR3 On-Chip Debug Register Bit 3 RW 0 OCDR2 On-Chip Debug Register Bit 2 RW 0 OCDR1 On-Chip Debug Register Bit 1 RW 0 OCDR0 On-Chip Debug Register Bit 0 RW 0 MCUCR MCU Control Register The MCU Control Register contains control bits for general MCU functions. $35 $55 io_flag.bmp Y JTD JTAG Interface Disable When this bit is written to zero, the JTAG interface is enabled if the JTAGEN fuse is programmed. If this bit is written to one, the JTAG interface is disabled. In order to avoid unintentional disabling or enabling of the JTAG interface, a timed sequence must be followed: The application software must write this to the desired value twice within four cycles to change the bit. RW 0 MCUSR MCU Status Register The MCU Status Register provides information on which reset source caused an MCU reset. $34 $54 io_flag.bmp Y JTRF JTAG Reset Flag This bit is set if a reset is being caused by a logic one in the JTAG Reset Register selected by the JTAG instruction AVR_RESET.This bit is reset by a Power-on reset,or by writing a logic zero to the flag. RW 0 [EICRA:EICRB:EIMSK:EIFR:PCICR:PCIFR:PCMSK2:PCMSK1:PCMSK0] [PCMSK2:PCMSK1:PCMSK0] io_ext.bmp The external interrupts are triggered by the INT7:0 pins. Observe that, if enabled, the interrupts will trigger even if the INT7:0 pins are configured as outputs. This feature provides a way of generating a software interrupt. The external inter-rupts can be triggered by a falling or rising edge or a low level. This is set up as indicated in the specification for the Exter-nal Interrupt Control Registers - EICRA (INT3:0) and EICRB (INT7:4). When the external interrupt is enabled and is configured as level triggered, the interrupt will trigger as long as the pin is held low. Note that recognition of falling or rising edge interrupts on INT7:4 requires the presence of an I/O clock, described in “Clock Systems and their Distribution” on page 29. Low level interrupts and the edge interrupt on INT3:0 are detected asynchronously. This implies that these inter-rupts can be used for waking the part also from sleep modes other than Idle mode. The I/O clock is halted in all sleep modes except Idle mode. Note that if a level triggered interrupt is used for wake-up from Power Down Mode, the changed level must be held for some time to wake up the MCU. This makes the MCU less sensitive to noise. The changed level is sampled twice by the watchdog oscillator clock. The period of the watchdog oscillator is 1 µs (nominal) at 5.0V and 25°C. The frequency of the watchdog oscillator is voltage dependent as shown in the Electrical Characteristics section. The MCU will wake up if the input has the required level during this sampling or if it is held until the end of the start-up time. The start-up time is defined by the SUT fuses as described in “Clock Systems and their Distribution” on page 29. If the level is sampled twice by the watchdog oscillator clock but disappears before the end of the start-up time, the MCU will still wake up, but no interrupt will be generated. The required level must be held long enough for the MCU to complete the wake up to trigger the level interrupt EICRA External Interrupt Control Register A This Register can not be reached in ATmega103 compatibility mode, but the initial value defines INT3:0 as low level inter-rupts,as in ATmega103. • Bits 7..0 - ISC31, ISC30 - ISC00, ISC00: External Interrupt 3-0 Sense Control bits The External Interrupts 3 - 0 are activated by the external pins INT3:0 if the SREG I-flag and the corresponding interrupt mask in the EIMSK is set. The level and edges on the external pins that activate the interrupts are defined in Table 47. Edges on INT3..INT0 are registered asynchronously. Pulses on INT3:0 pins wider than the minimum pulse width given in Table 48 will generate an interrupt. Shorter pulses are not guaranteed to generate an interrupt. If low level interrupt is selected, the low level must be held until the completion of the currently executing instruction to generate an interrupt. If enabled, a level triggered interrupt will generate an interrupt request as long as the pin is held low. When changing the ISCn bit, an interrupt can occur. Therefore, it is recommended to first disable INTn by clearing its Interrupt Enable bit in the EIMSK register. Then, the ISCn bit can be changed. Finally, the INTn interrupt flag should be cleared by writing a logical one to its Interrupt Flag bit (INTFn) in the EIFR register before the interrupt is re-enable NA $69 io_flag.bmp Y ISC31 External Interrupt Sense Control Bit RW 0 ISC30 External Interrupt Sense Control Bit RW 0 ISC21 External Interrupt Sense Control Bit RW 0 ISC20 External Interrupt Sense Control Bit RW 0 ISC11 External Interrupt Sense Control Bit RW 0 ISC10 External Interrupt Sense Control Bit RW 0 ISC01 External Interrupt Sense Control Bit RW 0 ISC00 External Interrupt Sense Control Bit RW 0 EICRB External Interrupt Control Register B The External Interrupts 7 - 4 are activated by the external pins INT7:4 if the SREG I-flag and the corresponding interrupt mask in the EIMSK is set. The level and edges on the external pins that activate the interrupts are defined in Table 49. The value on the INT7:4 pins are sampled before detecting edges. If edge or toggle interrupt is selected, pulses that last longer than one clock period will generate an interrupt. Shorter pulses are not guaranteed to generate an interrupt. Observe that CPU clock frequency can be lower than the XTAL frequency if the XTAL divider is enabled. If low level interrupt is selected, the low level must be held until the completion of the currently executing instruction to generate an interrupt. If enabled, a level triggered interrupt will generate an interrupt request as long as the pin is held low NA $6A io_flag.bmp Y ISC71 External Interrupt 7-4 Sense Control Bit RW 0 ISC70 External Interrupt 7-4 Sense Control Bit RW 0 ISC61 External Interrupt 7-4 Sense Control Bit RW 0 ISC60 External Interrupt 7-4 Sense Control Bit RW 0 ISC51 External Interrupt 7-4 Sense Control Bit RW 0 ISC50 External Interrupt 7-4 Sense Control Bit RW 0 ISC41 External Interrupt 7-4 Sense Control Bit RW 0 ISC40 External Interrupt 7-4 Sense Control Bit RW 0 EIMSK External Interrupt Mask Register When an INT7- INT4 bit is written to one and the I-bit in the Status Register (SREG) is set (one), the corresponding external pin interrupt is enabled. The Interrupt Sense Control bits in the External Interrupt Control Registers - EICRA and EICRB defines whether the external interrupt is activated on rising or falling edge or level sensed. Activity on any of these pins will trigger an interrupt request even if the pin is enabled as an output. This provides a way of generating a software interrupt. $1D $3D io_flag.bmp Y INT7 External Interrupt Request 7 Enable RW 0 INT6 External Interrupt Request 6 Enable RW 0 INT5 External Interrupt Request 5 Enable RW 0 INT4 External Interrupt Request 4 Enable RW 0 INT3 External Interrupt Request 3 Enable RW 0 INT2 External Interrupt Request 2 Enable RW 0 INT1 External Interrupt Request 1 Enable RW 0 INT0 External Interrupt Request 0 Enable RW 0 EIFR External Interrupt Flag Register When an event on the INT7 - INT0 pins triggers an interrupt request, the corresponding interrupt flag, INTF7 - INTF0 becomes set (one). If the I-bit in SREG and the corresponding interrupt enable bit, INT7 - INT0 in EIMSK, are set (one), the MCU will jump to the interrupt vector. The flag is cleared when the interrupt routine is executed. Alternatively, the flag is cleared by writing a logical one to it. Note that when entering some sleep modes with the INT3:0 interrupts disabled, the input buffers on these pin will be disabled. This may cause a logic change in internal signals which will set the INTF3:0 flags. See “Digital Input Enable and Sleep Modes” on page 54 for more informa $1C $3C io_flag.bmp Y INTF7 External Interrupt Flag 7 RW 0 INTF6 External Interrupt Flag 6 RW 0 INTF5 External Interrupt Flag 5 RW 0 INTF4 External Interrupt Flag 4 RW 0 INTF3 External Interrupt Flag 3 RW 0 INTF2 External Interrupt Flag 2 RW 0 INTF1 External Interrupt Flag 1 RW 0 INTF0 External Interrupt Flag 0 RW 0 PCMSK2 Pin Change Mask Register 2 Each PCINT23..16 bit selects whether pin change interrupt is enabled on the corresponding I/O pin. If PCINT15..8 is set and the PCIE1 bit in EIMSK is set, pin change interrupt is enabled on the corresponding I/O pin. If PCINT23..16 is cleared, pin change interrupt on the corresponding I/O pin is disabled. NA $6D io_flag.bmp N PCINT23 Pin Change Enable Mask 23 RW 0 PCINT22 Pin Change Enable Mask 22 RW 0 PCINT21 Pin Change Enable Mask 21 RW 0 PCINT20 Pin Change Enable Mask 20 RW 0 PCINT19 Pin Change Enable Mask 19 RW 0 PCINT18 Pin Change Enable Mask 18 RW 0 PCINT17 Pin Change Enable Mask 17 RW 0 PCINT16 Pin Change Enable Mask 16 RW 0 PCMSK1 Pin Change Mask Register 1 Each PCINT15..8 bit selects whether pin change interrupt is enabled on the corresponding I/O pin. If PCINT15..8 is set and the PCIE1 bit in EIMSK is set, pin change interrupt is enabled on the corresponding I/O pin. If PCINT15..8 is cleared, pin change interrupt on the corresponding I/O pin is disabled. NA $6C io_flag.bmp N PCINT15 Pin Change Enable Mask 15 RW 0 PCINT14 Pin Change Enable Mask 14 RW 0 PCINT13 Pin Change Enable Mask 13 RW 0 PCINT12 Pin Change Enable Mask 12 RW 0 PCINT11 Pin Change Enable Mask 11 RW 0 PCINT10 Pin Change Enable Mask 10 RW 0 PCINT9 Pin Change Enable Mask 9 RW 0 PCINT8 Pin Change Enable Mask 8 RW 0 PCMSK0 Pin Change Mask Register 0 Each PCINT bit selects whether pin change interrupt is enabled on the corresponding I/O pin. If PCINT7..0 is set and the PCIE0 bit in EIMSK is set, pin change interrupt is enabled on the corresponding I/O pin. If PCINT7..0 is cleared, pin change interrupt on the corresponding I/O pin is disabled. NA $6B io_flag.bmp N PCINT7 Pin Change Enable Mask 7 RW 0 PCINT6 Pin Change Enable Mask 6 RW 0 PCINT5 Pin Change Enable Mask 5 RW 0 PCINT4 Pin Change Enable Mask 4 RW 0 PCINT3 Pin Change Enable Mask 3 RW 0 PCINT2 Pin Change Enable Mask 2 RW 0 PCINT1 Pin Change Enable Mask 1 RW 0 PCINT0 Pin Change Enable Mask 0 RW 0 PCIFR Pin Change Interrupt Flag Register $1B $3B io_flag.bmp Y PCIF2 Pin Change Interrupt Flag 2 When a logic change on any PCINT23..16 pin triggers an interrupt request, PCIF2 becomes set (one). If the I-bit in SREG and the PCIE2 bit in PCICR are set (one), the MCU will jump to the corresponding Interrupt Vector. The flag is cleared when the interrupt routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. RW 0 PCIF1 Pin Change Interrupt Flag 1 When a logic change on any PCINT14..8 pin triggers an interrupt request, PCIF1 becomes set (one). If the I-bit in SREG and the PCIE1 bit in PCICR are set (one), the MCU will jump to the corresponding Interrupt Vector. The flag is cleared when the interrupt routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. RW 0 PCIF0 Pin Change Interrupt Flag 0 When a logic change on any PCINT7..0 pin triggers an interrupt request, PCIF0 becomes set (one). If the I-bit in SREG and the PCIE0 bit in PCICR are set (one), the MCU will jump to the corresponding Interrupt Vector. The flag is cleared when the interrupt routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. RW 0 PCICR Pin Change Interrupt Control Register NA $68 io_flag.bmp Y PCIE2 Pin Change Interrupt Enable 2 RW 0 PCIE1 Pin Change Interrupt Enable 1 RW 0 PCIE0 Pin Change Interrupt Enable 0 RW 0 [SREG:SPH:SPL:MCUCR:MCUSR:XMCRA:XMCRB:OSCCAL:CLKPR:SMCR:RAMPZ:EIND:GPIOR2:GPIOR1:GPIOR0:PRR1:PRR0] [SPH:SPL] io_cpu.bmp SREG Status Register $3F $5F io_sreg.bmp Y I Global Interrupt Enable The global interrupt enable bit must be set (one) for the interrupts to be enabled. The individual interrupt enable control is then performed in separate control registers. If the global interrupt enable bit is cleared (zero), none of the interrupts are enabled independent of the individual interrupt enable settings. The I-bit is cleared by hardware after an interrupt has occurred, and is set by the RETI instruction to enable subsequent interrupts. RW 0 T Bit Copy Storage The bit copy instructions BLD (Bit LoaD) and BST (Bit STore) use the T bit as source and destination for the operated bit. A bit from a register in the register file can be copied into T by the BST instruction, and a bit in T can be copied into a bit in a register in the register file by the BLD instruction. RW 0 H Half Carry Flag The half carry flag H indicates a half carry in some arithmetic operations. See the Instruction Set Description for detailed information. RW 0 S Sign Bit The S-bit is always an exclusive or between the negative flag N and the two’s complement overflow flag V. See the Instruc-tion Set Description for detailed information. RW 0 V Two's Complement Overflow Flag The two’s complement overflow flag V supports two’s complement arithmetics. See the Instruction Set Description for detailed information. RW 0 N Negative Flag The negative flag N indicates a negative result after the different arithmetic and logic operations. See the Instruction Set Description for detailed information. RW 0 Z Zero Flag The zero flag Z indicates a zero result after the different arithmetic and logic operations. See the Instruction Set Description for detailed information. RW 0 C Carry Flag The carry flag C indicates a carry in an arithmetic or logic operation. See the Instruction Set Description for detailed information. Note that the status register is not automatically stored when entering an interrupt routine and restored when returning from an interrupt routine. This must be handled by software. RW 0 SPH Stack Pointer High The general AVR 16-bit Stack Pointer is effectively built up of two 8-bit registers in the I/O space locations $3E ($5E) and $3D ($5D). As the AT90S4414/8515 supports up to 64 kB external SRAM, all 16-bits are used. The Stack Pointer points to the data SRAM stack area where the Subroutine and Interrupt Stacks are located. This Stack space in the data SRAM must be defined by the program before any subroutine calls are executed or interrupts are enabled. The stack pointer must be set to point above $60. The Stack Pointer is decremented by one when data is pushed onto the Stack with the PUSH instruction, and it is decremented by two when an address is pushed onto the Stack with subroutine calls and interrupts. The Stack Pointer is incremented by one when data is popped from the Stack with the POP instruction, and it is incremented by two when an address is popped from the Stack with return from subroutine RET or return from interrupt R $3E $5E io_sph.bmp N SP15 Stack pointer bit 15 RW 0 SP14 Stack pointer bit 14 RW 0 SP13 Stack pointer bit 13 RW 1 SP12 Stack pointer bit 12 RW 0 SP11 Stack pointer bit 11 RW 0 SP10 Stack pointer bit 10 RW 0 SP9 Stack pointer bit 9 RW 0 SP8 Stack pointer bit 8 RW 1 SPL Stack Pointer Low The general AVR 16-bit Stack Pointer is effectively built up of two 8-bit registers in the I/O space locations $3E ($5E) and $3D ($5D). As the AT90S4414/8515 supports up to 64 kB external SRAM, all 16-bits are used. The Stack Pointer points to the data SRAM stack area where the Subroutine and Interrupt Stacks are located. This Stack space in the data SRAM must be defined by the program before any subroutine calls are executed or interrupts are enabled. The stack pointer must be set to point above $60. The Stack Pointer is decremented by one when data is pushed onto the Stack with the PUSH instruction, and it is decremented by two when an address is pushed onto the Stack with subroutine calls and interrupts. The Stack Pointer is incremented by one when data is popped from the Stack with the POP instruction, and it is incremented by two when an address is popped from the Stack with return from subroutine RET or return from interrupt $3D $5D io_sph.bmp N SP7 Stack pointer bit 7 RW 1 SP6 Stack pointer bit 6 RW 1 SP5 Stack pointer bit 5 RW 1 SP4 Stack pointer bit 4 RW 1 SP3 Stack pointer bit 3 RW 1 SP2 Stack pointer bit 2 RW 1 SP1 Stack pointer bit 1 RW 1 SP0 Stack pointer bit 0 RW 1 MCUCR MCU Control Register The MCU Control Register contains control bits for general MCU functions. $35 $55 io_flag.bmp Y JTD JTAG Interface Disable When this bit is zero, the JTAG interface is enabled if the JTAGEN Fuse is programmed. RW 0 PUD Pull-up disable When this bit is written to one,the pull-ups in the I/O ports are disabled even if the DDxn and PORTxn registers are configured to enable the pull-ups ({DDxn,PORTxn}=0b01). RW 0 IVSEL Interrupt Vector Select When the IVSEL bit is cleared (zero),the interrupt vectors are placed at the start of the Flash memory.When this bit is set (one),the interrupt vectors are moved to the beginning of the Boot Loader section of the flash.The actual address of the start of the boot flash section is determined by the BOOTSZ fuses. RW 0 IVCE Interrupt Vector Change Enable The IVCE bit must be written to logic one to enable change of the IVSEL bit.IVCE is cleared by hardware four cycles after it is written or when IVSEL is written.Setting the IVCE bit will disable interrupts. RW 0 MCUSR MCU Status Register The MCU Status Register provides information on which reset source caused an MCU reset. $34 $54 io_flag.bmp Y JTRF JTAG Reset Flag This bit is set if a reset is being caused by a logic one in the JTAG Reset Register selected by the JTAG instruction AVR_RESET. This bit is reset by a Power-on reset, or by writing a logic zero to the flag. • Bit 3 - WDRF: Watchdog Reset Flag R/W 0 WDRF Watchdog Reset Flag This bit is set if a watchdog reset occurs. The bit is reset by a power-on reset, or by writing a logic zero to the flag. R/W 0 BORF Brown-out Reset Flag This bit is set if a brown-out reset occurs. The bit is reset by a power-on reset, or by writing a logic zero to the flag. R/W 0 EXTRF External Reset Flag This bit is set if an external reset occurs. The bit is reset by a power-on reset, or by writing a logic zero to the flag. R/W 0 PORF Power-on reset flag This bit is set if a power-on reset occurs. The bit is reset only by writing a logic zero to the flag. To make use of the reset flags to identify a reset condition, the user should read and then reset the MCUCSR as early as possible in the program. If the register is cleared before another reset occurs, the source of the reset can be found by examining the reset flags. R/W 0 XMCRA External Memory Control Register A NA $74 io_cpu.bmp Y SRE External SRAM Enable Writing SRE to one enables the External Memory Interface. RW 0 SRL2 Wait state page limit It is possible to configure different wait-states for different external memory addresses. RW 0 SRL1 Wait state page limit It is possible to configure different wait-states for different external memory addresses. RW 0 SRL0 Wait state page limit It is possible to configure different wait-states for different external memory addresses. RW 0 SRW11 Wait state select bit upper page RW 0 SRW10 Wait state select bit upper page RW 0 SRW01 Wait state select bit lower page RW 0 SRW00 Wait state select bit lower page RW 0 XMCRB External Memory Control Register B NA $75 io_cpu.bmp Y XMBK External Memory Bus Keeper Enable Port C pins release command. RW 0 XMM2 External Memory High Mask Port C pins released. RW 0 XMM1 External Memory High Mask Port C pins released. RW 0 XMM0 External Memory High Mask Port C pins released. RW 0 OSCCAL Oscillator Calibration Value Writing the calibration byte to this address will trim the internal oscillator to remove process variations from the oscillator frequency. This is done automatically during chip reset. When OSCCAL is zero, the lowest available frequency is chosen. Writing non-zero values to this register will increase the frequency of the internal oscillator. Writing $FF to the register gives the highest available frequency. The calibrated oscillator is used to time EEPROM and Flash access. If EEPROM or Flash is written, do not calibrate to more than 10% above the nominal frequency. Otherwise, the EEPROM or Flash write may fail. Note that the Oscillator is intended for calibration to 1.0 MHz, 2.0 MHz, 4.0 MHz, or 8.0MHz. Tuning to other values is not guaranteed, as indicated in Table 14 NA $66 io_cpu.bmp N CAL7 Oscillator Calibration Value Bit7 R/W 0 CAL6 Oscillator Calibration Value Bit6 R/W 0 CAL5 Oscillator Calibration Value Bit5 R/W 0 CAL4 Oscillator Calibration Value Bit4 R/W 0 CAL3 Oscillator Calibration Value Bit3 R/W 0 CAL2 Oscillator Calibration Value Bit2 R/W 0 CAL1 Oscillator Calibration Value Bit1 R/W 0 CAL0 Oscillator Calibration Value Bit0 R/W 0 CLKPR NA $61 io_cpu.bmp Y CLKPCE CLKPS3 CLKPS2 CLKPS1 CLKPS0 SMCR Sleep Mode Control Register The Sleep Mode Control Register contains control bits for power management. $33 $53 io_cpu.bmp Y SM2 Sleep Mode Select bit 2 These bits select between the five available sleep modes. RW 0 SM1 Sleep Mode Select bit 1 These bits select between the five available sleep modes. RW 0 SM0 Sleep Mode Select bit 0 These bits select between the five available sleep modes. RW 0 SE Sleep Enable The SE bit must be written to logic one to make the MCU enter the sleep mode when the SLEEP instruction is executed.To RW 0 EIND Extended Indirect Register $3C $5C io_cpu.bmp N EIND0 Bit 0 For EICALL/EIJMP instructions. RW 0 RAMPZ RAM Page Z Select Register $3B $5B io_cpu.bmp N RAMPZ1 RAM Page Z Select Register Bit 1 The RAMPZ register is normally used to select which 64K RAM Page is accessed by the Z pointer. RW 0 RAMPZ0 RAM Page Z Select Register Bit 0 The RAMPZ register is normally used to select which 64K RAM Page is accessed by the Z pointer. RW 0 GPIOR2 General Purpose IO Register 2 The ATmega169 contains three General Purpose I/O Registers.These registers can be used for storing any information, and they are particularly useful for storing global variables and status flags.General Purpose I/O Registers within the address range $00 -$1F are directly bit-accessible using the SBI,CBI,SBIS,and SBIC instructions. $2B $4B io_cpu.bmp Y GPIOR27 General Purpose IO Register 2 bit 7 RW 0 GPIOR26 General Purpose IO Register 2 bit 6 RW 0 GPIOR25 General Purpose IO Register 2 bit 5 RW 0 GPIOR24 General Purpose IO Register 2 bit 4 RW 0 GPIOR23 General Purpose IO Register 2 bit 3 RW 0 GPIOR22 General Purpose IO Register 2 bit 2 RW 0 GPIOR21 General Purpose IO Register 2 bit 1 RW 0 GPIOR20 General Purpose IO Register 2 bit 0 RW 0 GPIOR1 General Purpose IO Register 1 The ATmega169 contains three General Purpose I/O Registers.These registers can be used for storing any information, and they are particularly useful for storing global variables and status flags.General Purpose I/O Registers within the address range $00 -$1F are directly bit-accessible using the SBI,CBI,SBIS,and SBIC instructions. $2A $4A io_cpu.bmp Y GPIOR17 General Purpose IO Register 1 bit 7 RW 0 GPIOR16 General Purpose IO Register 1 bit 6 RW 0 GPIOR15 General Purpose IO Register 1 bit 5 RW 0 GPIOR14 General Purpose IO Register 1 bit 4 RW 0 GPIOR13 General Purpose IO Register 1 bit 3 RW 0 GPIOR12 General Purpose IO Register 1 bit 2 RW 0 GPIOR11 General Purpose IO Register 1 bit 1 RW 0 GPIOR10 General Purpose IO Register 1 bit 0 RW 0 GPIOR0 General Purpose IO Register 0 The ATmega169 contains three General Purpose I/O Registers.These registers can be used for storing any information, and they are particularly useful for storing global variables and status flags.General Purpose I/O Registers within the address range $00 -$1F are directly bit-accessible using the SBI,CBI,SBIS,and SBIC instructions. $1E $3E io_cpu.bmp Y GPIOR07 General Purpose IO Register 0 bit 7 RW 0 GPIOR06 General Purpose IO Register 0 bit 6 RW 0 GPIOR05 General Purpose IO Register 0 bit 5 RW 0 GPIOR04 General Purpose IO Register 0 bit 4 RW 0 GPIOR03 General Purpose IO Register 0 bit 3 RW 0 GPIOR02 General Purpose IO Register 0 bit 2 RW 0 GPIOR01 General Purpose IO Register 0 bit 1 RW 0 GPIOR00 General Purpose IO Register 0 bit 0 RW 0 PRR1 Power Reduction Register1 The Power Reduction Register, PRR1, provides a method to stop the clock to individual peripherals to reduce power consumption. NA $65 io_cpu.bmp Y PRTIM5 Power Reduction Timer/Counter5 R/W 0 PRTIM4 Power Reduction Timer/Counter4 R/W 0 PRTIM3 Power Reduction Timer/Counter3 R/W 0 PRUSART3 Power Reduction USART3 R/W 0 PRUSART2 Power Reduction USART2 R/W 0 PRUSART1 Power Reduction USART1 R/W 0 PRR0 Power Reduction Register0 The Power Reduction Register, PRR, provides a method to stop the clock to individual peripherals to reduce power consumption. NA $64 io_cpu.bmp Y PRTWI Power Reduction TWI R/W 0 PRTIM2 Power Reduction Timer/Counter2 R/W 0 PRTIM0 Power Reduction Timer/Counter0 R/W 0 PRTIM1 Power Reduction Timer/Counter1 R/W 0 PRSPI Power Reduction Serial Peripheral Interface R/W 0 PRUSART0 Power Reduction USART R/W 0 PRADC Power Reduction ADC R/W 0 [ADMUX:ADCSRA:ADCSRB:ADCH:ADCL:DIDR0:DIDR2] ((IF ADMUX.ADLAR = 1) LINK [ADCH(1:0):ADCL(7:0)]); (IF ADMUX.ADLAR = 0) LINK [ADCH(7:0):ADCL(7:6)]); io_analo.bmp AD Converter Feature list: 10-bit Resolution. 0.5 LSB Integral Non-Linearity. +-2 LSB Absolute Accuracy. TBD - 260 µs Conversion Time. Up to TBD kSPS at maximum resolution. 8 Multiplexed Single Ended Input Channels. 7 Differential input channels (TQFP package only). 2 Differential input channels with optional gain of 10x and 200x (TQFP package only). Optional left adjustment for ADC result readout. 0 - VCC ADC Input Voltage Range. Selectable 2.56 V ADC reference voltage. Free Running or Single Conversion Mode. Interrupt on ADC Conversion Complete. Sleep Mode No ADMUX The ADC multiplexer Selection Register NA $7C io_analo.bmp Y REFS1 Reference Selection Bit 1 These bits select the voltage reference for the ADC, as shown in Table 91. If these bits are changed during a conversion, the change will not go in effect until this conversion is complete (ADIF in ADCSR is set). If differential channels are used, the selected reference should not be closer to AV CC than indicated in Table 94 on page 200. The internal voltage reference options may not be used if an external reference voltage is being applied to the AREF pin. RW 0 REFS0 Reference Selection Bit 0 These bits select the voltage reference for the ADC, as shown in Table 91. If these bits are changed during a conversion, the change will not go in effect until this conversion is complete (ADIF in ADCSR is set). If differential channels are used, the selected reference should not be closer to AV CC than indicated in Table 94 on page 200. The internal voltage reference options may not be used if an external reference voltage is being applied to the AREF pin. RW 0 ADLAR Left Adjust Result The ADLAR bit affects the presentation of the ADC conversion result in the ADC data register. If ADLAR is cleared, the result is right adjusted. If ADLAR is set, the result is left adjusted. Changing the ADLAR bit will affect the ADC data register immediately, regardless of any ongoing conversions. For a complete description of this bit, see “The ADC Data Register -ADCL and ADCH” on page 198. RW 0 MUX4 Analog Channel and Gain Selection Bits The value of these bits selects which combination of analog inputs are connected to the ADC. These bits also select the gain for the differential channels. See Table 92 for details. If these bits are changed during a conversion, the change will not go in effect until this conversion is complete (ADIF in ADCSR is set). RW 0 MUX3 Analog Channel and Gain Selection Bits The value of these bits selects which combination of analog inputs are connected to the ADC. These bits also select the gain for the differential channels. See Table 92 for details. If these bits are changed during a conversion, the change will not go in effect until this conversion is complete (ADIF in ADCSR is set). RW 0 MUX2 Analog Channel and Gain Selection Bits The value of these bits selects which combination of analog inputs are connected to the ADC. These bits also select the gain for the differential channels. See Table 92 for details. If these bits are changed during a conversion, the change will not go in effect until this conversion is complete (ADIF in ADCSR is set). RW 0 MUX1 Analog Channel and Gain Selection Bits The value of these bits selects which combination of analog inputs are connected to the ADC. These bits also select the gain for the differential channels. See Table 92 for details. If these bits are changed during a conversion, the change will not go in effect until this conversion is complete (ADIF in ADCSR is set). RW 0 MUX0 Analog Channel and Gain Selection Bits The value of these bits selects which combination of analog inputs are connected to the ADC. These bits also select the gain for the differential channels. See Table 92 for details. If these bits are changed during a conversion, the change will not go in effect until this conversion is complete (ADIF in ADCSR is set). RW 0 ADCH ADC Data Register High Byte When an ADC conversion is complete, the result is found in these two registers. If differential channels are used, the result is presented in two’s complement form. The selected channel is differential if MUX4..0 are between ‘01000’ and ‘11101’, otherwise the selected channel is single ended. When ADCL is read, the ADC Data Register is not updated until ADCH is read. Consequently, if the result is left adjusted and no more than 8 bit precision (7 bit + sign bit for differential input channels) is required, it is sufficient to read ADCH. Otherwise, ADCL must be read first, then ADCH. The ADLAR bit in ADMUX, and the MUX4..0 bits in ADMUX affect the way the result is read from the registers. If ADLAR is set, the result is left adjusted. If ADLAR is cleared (default), the result is right adju NA $79 io_analo.bmp N ADCH7 ADC Data Register High Byte Bit 7 RW 0 ADCH6 ADC Data Register High Byte Bit 6 RW 0 ADCH5 ADC Data Register High Byte Bit 5 RW 0 ADCH4 ADC Data Register High Byte Bit 4 RW 0 ADCH3 ADC Data Register High Byte Bit 3 RW 0 ADCH2 ADC Data Register High Byte Bit 2 RW 0 ADCH1 ADC Data Register High Byte Bit 1 RW 0 ADCH0 ADC Data Register High Byte Bit 0 RW 0 ADCL ADC Data Register Low Byte When an ADC conversion is complete, the result is found in these two registers. If differential channels are used, the result is presented in two’s complement form. The selected channel is differential if MUX4..0 are between ‘01000’ and ‘11101’, otherwise the selected channel is single ended. When ADCL is read, the ADC Data Register is not updated until ADCH is read. Consequently, if the result is left adjusted and no more than 8 bit precision (7 bit + sign bit for differential input channels) is required, it is sufficient to read ADCH. Otherwise, ADCL must be read first, then ADCH. The ADLAR bit in ADMUX, and the MUX4..0 bits in ADMUX affect the way the result is read from the registers. If ADLAR is set, the result is left adjusted. If ADLAR is cleared (default), the result is right ad NA $78 io_analo.bmp N ADCL7 ADC Data Register Low Byte Bit 7 RW 0 ADCL6 ADC Data Register Low Byte Bit 6 RW 0 ADCL5 ADC Data Register Low Byte Bit 5 RW 0 ADCL4 ADC Data Register Low Byte Bit 4 RW 0 ADCL3 ADC Data Register Low Byte Bit 3 RW 0 ADCL2 ADC Data Register Low Byte Bit 2 RW 0 ADCL1 ADC Data Register Low Byte Bit 1 RW 0 ADCL0 ADC Data Register Low Byte Bit 0 RW 0 ADCSRA The ADC Control and Status register A NA $7A io_flag.bmp Y ADEN ADC Enable Writing a logical ‘1’ to this bit enables the ADC. By clearing this bit to zero, the ADC is turned off. Turning the ADC off while a conversion is in progress, will terminate this conversion. RW 0 ADSC ADC Start Conversion In Single Conversion Mode, a logical ‘1’ must be written to this bit to start each conversion. In Free Running Mode, a logical ‘1’ must be written to this bit to start the first conversion. The first time ADSC has been written after the ADC has been enabled, or if ADSC is written at the same time as the ADC is enabled, an extended conversion will result. This extended conversion performs initialization of the ADC. ADSC will read as one as long as a conversion is in progress. When the conversion is complete, it returns to zero. When a dummy conversion precedes a real conversion, ADSC will stay high until the real conversion completes. Writing a 0 to this bit has no effect RW 0 ADATE ADC Auto Trigger Enable When this bit is written to one, Auto Triggering of the ADC is enabled. The ADC will start a conversion on a positive edge of the selected trigger signal. The trigger source is selected by setting the ADC Trigger Select bits, ADTS in ADCSRB. RW 0 ADIF ADC Interrupt Flag This bit is set (one) when an ADC conversion completes and the data registers are updated. The ADC Conversion Complete Interrupt is executed if the ADIE bit and the I-bit in SREG are set (one). ADIF is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, ADIF is cleared by writing a logical one to the flag. Beware that if doing a read-modify-write on ADCSR, a pending interrupt can be disabled. This also applies if the SBI and CBI instructions are used. RW 0 ADIE ADC Interrupt Enable When this bit is set (one) and the I-bit in SREG is set (one), the ADC Conversion Complete Interrupt is activated. RW 0 ADPS2 ADC Prescaler Select Bits These bits determine the division factor between the XTAL frequency and the input clock to the ADC. RW 0 ADPS1 ADC Prescaler Select Bits These bits determine the division factor between the XTAL frequency and the input clock to the ADC. RW 0 ADPS0 ADC Prescaler Select Bits These bits determine the division factor between the XTAL frequency and the input clock to the ADC. RW 0 ADCSRB The ADC Control and Status register B NA $7B io_flag.bmp Y ACME RW 0 MUX5 Analog Channel and Gain Selection Bits The value of these bits selects which combination of analog inputs are connected to the ADC. These bits also select the gain for the differential channels. See Table 92 for details. If these bits are changed during a conversion, the change will not go in effect until this conversion is complete (ADIF in ADCSR is set). RW 0 ADTS2 ADC Auto Trigger Source bit 2 Please refer to table on page 240 in datasheet for trigger selection. RW 0 ADTS1 ADC Auto Trigger Source bit 1 Please refer to table on page 240 in datasheet for trigger selection. RW 0 ADTS0 ADC Auto Trigger Source bit 0 Please refer to table on page 240 in datasheet for trigger selection. RW 0 DIDR2 Digital Input Disable Register When this bit is written logic one, the digital input buffer on the corresponding ADC pin is disabled. The corresponding PIN Register bit will always read as zero when this bit is set. When an analog signal is applied to the ADC7..0 pin and the digital input from this pin is not needed, this bit should be written logic one to reduce power consumption in the digital input buffer. NA $7D io_analo.bmp Y ADC15D RW 0 ADC14D RW 0 ADC13D RW 0 ADC12D RW 0 ADC11D RW 0 ADC10D RW 0 ADC9D RW 0 ADC8D RW 0 DIDR0 Digital Input Disable Register When this bit is written logic one, the digital input buffer on the corresponding ADC pin is disabled. The corresponding PIN Register bit will always read as zero when this bit is set. When an analog signal is applied to the ADC7..0 pin and the digital input from this pin is not needed, this bit should be written logic one to reduce power consumption in the digital input buffer. NA $7E io_analo.bmp Y ADC7D RW 0 ADC6D RW 0 ADC5D RW 0 ADC4D RW 0 ADC3D RW 0 ADC2D RW 0 ADC1D RW 0 ADC0D RW 0 [SPMCSR] io_cpu.bmp AVRSimIOSPM.SimIOSPM The Boot Loader Support provides a real Read While Write self-programming mechanism for downloading and uploading program code by the MCU itself. This feature allows flexible application software updates controlled by the MCU using a Flash-resident Boot Loader program. The Boot Loader program can use any available data interface and associated proto-col to read code and write (program) that code into the Flash memory, or read the code from the program memory. The program code within the Boot Loader section has the capability to write into the entire Flash, including the Boot Loader Memory. The Boot Loader can thus even modify itself, and it can also erase itself from the code if the feature is not needed anymore. The size of the Boot Loader Memory is configurable with fuses and the Boot Loader has two separate sets of Boot Lock Bits which can be set independently. This gives the user a unique flexibility to select different levels of protection. Boot Loader Features: Read While Write self-programming. Flexibl Boot Memory size. High security (separate Boot Lock bits for a flexible protection). Separate fuse to select reset vector Optimized page (1) size. Code efficient algorithm Efficient read-modify-write suppor SPMCSR Store Program Memory Control Register The Store Program Memory Control Register contains the control bits needed to control the Boot Loader operations. $37 $57 io_flag.bmp Y SPMIE SPM Interrupt Enable When the SPMIE bit is written to one, and the I-bit in the Status Register is set (one), the SPM ready interrupt will be enabled. The SPM ready Interrupt will be executed as long as the SPMEN bit in the SPMCR register is cleared. RW 0 RWWSB Read While Write Section Busy When a self-programming (page erase or page write) operation to the RWW section is initiated, the RWWSB will be set (one) by hardware. When the RWWSB bit is set, the RWW section cannot be accessed. The RWWSB bit will be cleared if the RWWSRE bit is written to one after a self-programming operation is completed. Alternatively the RWWSB bit will auto-matically be cleared if a page load operation is initiated. R 0 SIGRD Signature Row Read If this bit is written to one at the same time as SPMEN, the next LPM instruction within three clock cycles will read a byte from the signature row into the destination register. see “Reading the Signature Row from Software” in the datasheet for details. An SPM instruction within four cycles after SIGRD and SPMEN are set will have no effect. This operation is reserved for future use and should not be used. RW 0 RWWSRE Read While Write section read enable When programming (page erase or page write) to the RWW section, the RWW section is blocked for reading (the RWWSB will be set by hardware). To re-enable the RWW section, the user software must wait until the programming is completed (SPMEN will be cleared). Then, if the RWWSRE bit is written to one at the same time as SPMEN, the next SPM instruction within four clock cycles re-enables the RWW section. The RWW section cannot be re-enabled while Flash is busy with a page erase or a page write (SPMEN is set). If the RWWSRE bit is written while the Flash is being loaded, the Flash load operation will abort and the data loaded will be lo RW 0 BLBSET Boot Lock Bit Set If this bit is written to one at the same time as SPMEN, the next SPM instruction within four clock cycles sets Boot Lock bits, according to the data in R0. The data in R1 and the address in the Z pointer are ignored. The BLBSET bit will automatically be cleared upon completion of the lock bit set, or if no SPM instruction is executed within four clock cycles. An LPM instruction within three cycles after BLBSET and SPMEN are set in the SPMCR register, will read either the Lock-bits or the Fuse bits (depending on Z0 in the Z pointer) into the destination register. See “Reading the Fuse and Lock Bits from Software” on page 235 for details RW 0 PGWRT Page Write If this bit is written to one at the same time as SPMEN, the next SPM instruction within four clock cycles executes page write, with the data stored in the temporary buffer. The page address is taken from the high part of the Z pointer. The data in R1 and R0 are ignored. The PGWRT bit will auto-clear upon completion of a page write, or if no SPM instruction is exe-cuted within four clock cycles. The CPU is halted during the entire page write operation if the NRWW section is addressed. RW 0 PGERS Page Erase If this bit is written to one at the same time as SPMEN, the next SPM instruction within four clock cycles executes page erase. The page address is taken from the high part of the Z pointer. The data in R1 and R0 are ignored. The PGERS bit will auto-clear upon completion of a page erase, or if no SPM instruction is executed within four clock cycles. The CPU is halted during the entire page write operation if the NRWW section is addressed. RW 0 SPMEN Store Program Memory Enable This bit enables the SPM instruction for the next four clock cycles. If written to one together with either RWWSRE, BLB-SET, PGWRT or PGERS, the following SPM instruction will have a special meaning, see description above. If only SPMEN is written, the following SPM instruction will store the value in R1:R0 in the temporary page buffer addressed by the Z pointer. The LSB of the Z pointer is ignored. The SPMEN bit will auto-clear upon completion of an SPM instruction, or if no SPM instruction is executed within four clock cycles. During page erase and page write, the SPMEN bit remain high until the operation is completed. Writing any other combination than “10001”, "01001", "00101", "00011" or "00001" in the lower five bits will have no effec RW 0 [UDR2:UCSR2A:UCSR2B:UCSR2C:UBRR2H:UBRR2L] [UBRR2H:UBRR2L] io_com.bmp The Universal Synchronous and Asynchronous serial Receiver and Transmitter (USART) is a highly flexible serial communication device. The main features are: • Full Duplex Operation (Independent Serial Receive and Transmit Registers) • Asynchronous or Synchronous Operation • Master or Slave Clocked Synchronous Operation • High Resolution Baud Rate Generator • Supports Serial Frames with 5, 6, 7, 8 or 9 Data Bits and 1 or 2 Stop Bits • Odd or Even Parity Generation and Parity Check Supported by Hardware • Data OverRun Detection • Framing Error Detection • Noise Filtering Includes False Start Bit Detection and Digital Low Pass Filter • Three Separate Interrupts on TX Complete, TX Data Register Empty and RX Complete • Multi-processor Communication Mode • Double Speed Asynchronous Communica UDR2 USART I/O Data Register The UDR2 register is actually two physically separate registers sharing the same I/O address. When writing to the register, the USART Transmit Data register is written. When reading from UDR0, the USART Receive Data register is read. NA $D6 io_com.bmp N UDR2-7 USART I/O Data Register bit 7 RW 0 UDR2-6 USART I/O Data Register bit 6 RW 0 UDR2-5 USART I/O Data Register bit 5 RW 0 UDR2-4 USART I/O Data Register bit 4 RW 0 UDR2-3 USART I/O Data Register bit 3 RW 0 UDR2-2 USART I/O Data Register bit 2 RW 0 UDR2-1 USART I/O Data Register bit 1 RW 0 UDR2-0 USART I/O Data Register bit 0 RW 0 UCSR2A USART Control and Status Register A NA $D0 io_flag.bmp Y RXC2 USART Receive Complete This bit is set (one) when a received character is transferred from the Receiver Shift register to UDR0. The bit is set regard-less of any detected framing errors. When the RXCIE bit in UCR is set, the USART Receive Complete interrupt will be executed when RXC is set(one). RXC is cleared by reading UDR0. When interrupt-driven data reception is used, the USART Receive Complete Interrupt routine must read UDRin order to clear RXC, otherwise a new interrupt will occur once the interrupt routine terminates. R 0 TXC2 USART Transmitt Complete This bit is set (one) when the entire character (including the stop bit) in the Transmit Shift register has been shifted out and no new data has been written to UDR0. This flag is especially useful in half-duplex communications interfaces, where a transmitting application must enter receive mode and free the communications bus immediately after completing the transmission. When the TXCIE bit in UCR is set, setting of TXC causes the USART Transmit Complete interrupt to be executed. TXC is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, the TXC bit is cleared (zero) by writing a logical one to the b RW 0 UDRE2 USART Data Register Empty This bit is set (one) when a character written to UDRis transferred to the Transmit shift register. Setting of this bit indicates that the transmitter is ready to receive a new character for transmission. When the UDR0IE bit in UCR is set, the USART Transmit Complete interrupt to be executed as long as UDR0E is set. UDR0E is cleared by writing UDR0. When interrupt-driven data transmittal is used, the USART Data Register Empty Interrupt routine must write UDRin order to clear UDR0E, otherwise a new interrupt will occur once the interrupt routine terminates. UDR0E is set (one) during reset to indicate that the transmitter is re R 1 FE2 Framing Error This bit is set if a Framing Error condition is detected, i.e. when the stop bit of an incoming character is zero. The FE bit is cleared when the stop bit of received data is one. R 0 DOR2 Data overRun This bit is set if an Overrun condition is detected, i.e. when a character already present in the UDRregister is not read before the next character has been shifted into the Receiver Shift register. The OR bit is buffered, which means that it will be set once the valid data still in UDR0E is read. The OR bit is cleared (zero) when data is received and transferred to UDR0. R 0 UPE2 Parity Error This bit is set if the next character in the receive buffer had a Parity Error when received and the parity checking was enabled at that point (UPM1 = 1). This bit is valid until the receive buffer (UDR0) is read. Always set this bit to zero when writing to UCSR0A. R 0 U2X2 Double the USART transmission speed This bit only has effect for the asynchronous operation. Write this bit to zero when using synchronous operation. Writing this bit to one will reduce the divisor of the baud rate divider from 16 to 8 effectively doubling the transfer rate for asynchronous communication. RW 0 MPCM2 Multi-processor Communication Mode This bit enables the Multi-processor Communication Mode. When the MPCM bit is written to one, all the incoming frames received by the USART receiver that do not contain address information will be ignored. The transmitter is unaffected by the MPCM setting. For more detailed information see “Multi-processor Communication Mode” on page 152. RW 0 UCSR2B USART Control and Status Register B NA $D1 io_flag.bmp Y RXCIE2 RX Complete Interrupt Enable Writing this bit to one enables interrupt on the RXC flag. A USART Receive Complete interrupt will be generated only if the RXCIE bit is written to one, the global interrupt flag in SREG is written to one and the RXC bit in UCSR0A is set. RW 0 TXCIE2 TX Complete Interrupt Enable Writing this bit to one enables interrupt on the TXC flag. A USART Transmit Complete interrupt will be generated only if the TXCIE bit is written to one, the global interrupt flag in SREG is written to one and the TXC bit in UCSR0A is set. RW 0 UDRIE2 USART Data register Empty Interrupt Enable Writing this bit to one enables interrupt on the UDR0E flag. A Data Register Empty interrupt will be generated only if the UDR0IE bit is written to one, the global interrupt flag in SREG is written to one and the UDR0E bit in UCSR0A is set. RW 1 RXEN2 Receiver Enable Writing this bit to one enables the USART receiver. The receiver will override normal port operation for the RxD pin when enabled. Disabling the receiver will flush the receive buffer invalidating the FE, DOR and PE flags. RW 0 TXEN2 Transmitter Enable Writing this bit to one enables the USART transmitter. The transmitter will override normal port operation for the TxD pin when enabled. The disabling of the transmitter (writing TXEN to zero) will not become effective until ongoing and pending transmissions are completed, i.e. when the transmit shift register and transmit buffer register does not contain data to be transmitted. When disabled, the transmitter will no longer override the TxD port. RW 0 UCSZ22 Character Size The UCSZ2 bits combined with the UCSZ1:0 bit in UCSR0C sets the number of data bits (character size) in a frame the receiver and transmitter use. RW 0 RXB82 Receive Data Bit 8 RXB8 is the 9th data bit of the received character when operating with serial frames with 9 data bits. Must be read before reading the low bits from UDR0. R 0 TXB82 Transmit Data Bit 8 TXB8 is the 9th data bit in the character to be transmitted when operating with serial frames with 9 data bits. Must be writ-ten before writing the low bits to UDR0. W 0 UCSR2C USART Control and Status Register C NA $D2 io_flag.bmp Y UMSEL21 USART Mode Select RW 0 UMSEL20 USART Mode Select RW 0 UPM21 Parity Mode Bit 1 This bit enable and set type of parity generation and check. If enabled, the transmitter will automatically generate and send the parity of the transmitted data bits within each frame. The receiver will generate a parity value for the incoming data and compare it to the UPM0 setting. If a mismatch is detected, the PE flag in UCSR0A will be set. RW 0 UPM20 Parity Mode Bit 0 This bit enable and set type of parity generation and check. If enabled, the transmitter will automatically generate and send the parity of the transmitted data bits within each frame. The receiver will generate a parity value for the incoming data and compare it to the UPM0 setting. If a mismatch is detected, the PE flag in UCSR0A will be set. RW 0 USBS2 Stop Bit Select 0: 1-bit. 1: 2-bit. RW 0 UCSZ21 Character Size Character Size: 0 0 0 = 5-bit. 0 0 1 = 6-bit. 0 1 0 = 7 bit. 0 1 1 = 8-bit. 1 1 1 = 9 bit. RW 1 UCSZ20 Character Size Character Size: 0 0 0 = 5-bit. 0 0 1 = 6-bit. 0 1 0 = 7 bit. 0 1 1 = 8-bit. 1 1 1 = 9 bit. RW 1 UCPOL2 Clock Polarity This bit is used for synchronous mode only. Write this bit to zero when asynchronous mode is used. The UCPOL bit sets the relationship between data output change and data input sample, and the synchronous clock (XCK). RW 0 UBRR2H USART Baud Rate Register High Byte This is a 12-bit register which contains the USART baud rate. The UBRR0H contains the 4 most significant bits, and the UBRR0L contains the 8 least significant bits of the USART baud rate. Ongoing transmissions by the transmitter and receiver will be corrupted if the baud rate is changed. Writing UBRR0L will trigger an immediate update of the baud rate prescaler. NA $D5 io_com.bmp N UBRR11 USART Baud Rate Register bit 11 RW 0 UBRR10 USART Baud Rate Register bit 10 RW 0 UBRR9 USART Baud Rate Register bit 9 RW 0 UBRR8 USART Baud Rate Register bit 8 RW 0 UBRR2L USART Baud Rate Register Low Byte This is a 12-bit register which contains the USART baud rate. The UBRR0H contains the 4 most significant bits, and the UBRR0L contains the 8 least significant bits of the USART baud rate. Ongoing transmissions by the transmitter and receiver will be corrupted if the baud rate is changed. Writing UBRR0L will trigger an immediate update of the baud rate prescaler. NA $D4 io_com.bmp N UBRR7 USART Baud Rate Register bit 7 RW 0 UBRR6 USART Baud Rate Register bit 6 RW 0 UBRR5 USART Baud Rate Register bit 5 RW 0 UBRR4 USART Baud Rate Register bit 4 RW 0 UBRR3 USART Baud Rate Register bit 3 RW 0 UBRR2 USART Baud Rate Register bit 2 RW 0 UBRR1 USART Baud Rate Register bit 1 RW 0 UBRR0 USART Baud Rate Register bit 0 RW 0 [UDR3:UCSR3A:UCSR3B:UCSR3C:UBRR3H:UBRR3L] [UBRR3H:UBRR3L] io_com.bmp The Universal Synchronous and Asynchronous serial Receiver and Transmitter (USART) is a highly flexible serial communication device. The main features are: • Full Duplex Operation (Independent Serial Receive and Transmit Registers) • Asynchronous or Synchronous Operation • Master or Slave Clocked Synchronous Operation • High Resolution Baud Rate Generator • Supports Serial Frames with 5, 6, 7, 8 or 9 Data Bits and 1 or 2 Stop Bits • Odd or Even Parity Generation and Parity Check Supported by Hardware • Data OverRun Detection • Framing Error Detection • Noise Filtering Includes False Start Bit Detection and Digital Low Pass Filter • Three Separate Interrupts on TX Complete, TX Data Register Empty and RX Complete • Multi-processor Communication Mode • Double Speed Asynchronous Communica UDR3 USART I/O Data Register The UDR3 register is actually two physically separate registers sharing the same I/O address. When writing to the register, the USART Transmit Data register is written. When reading from UDR0, the USART Receive Data register is read. NA $136 io_com.bmp N UDR3-7 USART I/O Data Register bit 7 RW 0 UDR3-6 USART I/O Data Register bit 6 RW 0 UDR3-5 USART I/O Data Register bit 5 RW 0 UDR3-4 USART I/O Data Register bit 4 RW 0 UDR3-3 USART I/O Data Register bit 3 RW 0 UDR3-2 USART I/O Data Register bit 2 RW 0 UDR3-1 USART I/O Data Register bit 1 RW 0 UDR3-0 USART I/O Data Register bit 0 RW 0 UCSR3A USART Control and Status Register A NA $130 io_flag.bmp Y RXC3 USART Receive Complete This bit is set (one) when a received character is transferred from the Receiver Shift register to UDR0. The bit is set regard-less of any detected framing errors. When the RXCIE bit in UCR is set, the USART Receive Complete interrupt will be executed when RXC is set(one). RXC is cleared by reading UDR0. When interrupt-driven data reception is used, the USART Receive Complete Interrupt routine must read UDRin order to clear RXC, otherwise a new interrupt will occur once the interrupt routine terminates. R 0 TXC3 USART Transmitt Complete This bit is set (one) when the entire character (including the stop bit) in the Transmit Shift register has been shifted out and no new data has been written to UDR0. This flag is especially useful in half-duplex communications interfaces, where a transmitting application must enter receive mode and free the communications bus immediately after completing the transmission. When the TXCIE bit in UCR is set, setting of TXC causes the USART Transmit Complete interrupt to be executed. TXC is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, the TXC bit is cleared (zero) by writing a logical one to the b RW 0 UDRE3 USART Data Register Empty This bit is set (one) when a character written to UDRis transferred to the Transmit shift register. Setting of this bit indicates that the transmitter is ready to receive a new character for transmission. When the UDR0IE bit in UCR is set, the USART Transmit Complete interrupt to be executed as long as UDR0E is set. UDR0E is cleared by writing UDR0. When interrupt-driven data transmittal is used, the USART Data Register Empty Interrupt routine must write UDRin order to clear UDR0E, otherwise a new interrupt will occur once the interrupt routine terminates. UDR0E is set (one) during reset to indicate that the transmitter is re R 1 FE3 Framing Error This bit is set if a Framing Error condition is detected, i.e. when the stop bit of an incoming character is zero. The FE bit is cleared when the stop bit of received data is one. R 0 DOR3 Data overRun This bit is set if an Overrun condition is detected, i.e. when a character already present in the UDRregister is not read before the next character has been shifted into the Receiver Shift register. The OR bit is buffered, which means that it will be set once the valid data still in UDR0E is read. The OR bit is cleared (zero) when data is received and transferred to UDR0. R 0 UPE3 Parity Error This bit is set if the next character in the receive buffer had a Parity Error when received and the parity checking was enabled at that point (UPM1 = 1). This bit is valid until the receive buffer (UDR0) is read. Always set this bit to zero when writing to UCSR0A. R 0 U2X3 Double the USART transmission speed This bit only has effect for the asynchronous operation. Write this bit to zero when using synchronous operation. Writing this bit to one will reduce the divisor of the baud rate divider from 16 to 8 effectively doubling the transfer rate for asynchronous communication. RW 0 MPCM3 Multi-processor Communication Mode This bit enables the Multi-processor Communication Mode. When the MPCM bit is written to one, all the incoming frames received by the USART receiver that do not contain address information will be ignored. The transmitter is unaffected by the MPCM setting. For more detailed information see “Multi-processor Communication Mode” on page 152. RW 0 UCSR3B USART Control and Status Register B NA $131 io_flag.bmp Y RXCIE3 RX Complete Interrupt Enable Writing this bit to one enables interrupt on the RXC flag. A USART Receive Complete interrupt will be generated only if the RXCIE bit is written to one, the global interrupt flag in SREG is written to one and the RXC bit in UCSR0A is set. RW 0 TXCIE3 TX Complete Interrupt Enable Writing this bit to one enables interrupt on the TXC flag. A USART Transmit Complete interrupt will be generated only if the TXCIE bit is written to one, the global interrupt flag in SREG is written to one and the TXC bit in UCSR0A is set. RW 0 UDRIE3 USART Data register Empty Interrupt Enable Writing this bit to one enables interrupt on the UDR0E flag. A Data Register Empty interrupt will be generated only if the UDR0IE bit is written to one, the global interrupt flag in SREG is written to one and the UDR0E bit in UCSR0A is set. RW 1 RXEN3 Receiver Enable Writing this bit to one enables the USART receiver. The receiver will override normal port operation for the RxD pin when enabled. Disabling the receiver will flush the receive buffer invalidating the FE, DOR and PE flags. RW 0 TXEN3 Transmitter Enable Writing this bit to one enables the USART transmitter. The transmitter will override normal port operation for the TxD pin when enabled. The disabling of the transmitter (writing TXEN to zero) will not become effective until ongoing and pending transmissions are completed, i.e. when the transmit shift register and transmit buffer register does not contain data to be transmitted. When disabled, the transmitter will no longer override the TxD port. RW 0 UCSZ32 Character Size The UCSZ3 bits combined with the UCSZ1:0 bit in UCSR0C sets the number of data bits (character size) in a frame the receiver and transmitter use. RW 0 RXB83 Receive Data Bit 8 RXB8 is the 9th data bit of the received character when operating with serial frames with 9 data bits. Must be read before reading the low bits from UDR0. R 0 TXB83 Transmit Data Bit 8 TXB8 is the 9th data bit in the character to be transmitted when operating with serial frames with 9 data bits. Must be writ-ten before writing the low bits to UDR0. W 0 UCSR3C USART Control and Status Register C NA $132 io_flag.bmp Y UMSEL31 USART Mode Select RW 0 UMSEL30 USART Mode Select RW 0 UPM31 Parity Mode Bit 1 This bit enable and set type of parity generation and check. If enabled, the transmitter will automatically generate and send the parity of the transmitted data bits within each frame. The receiver will generate a parity value for the incoming data and compare it to the UPM0 setting. If a mismatch is detected, the PE flag in UCSR0A will be set. RW 0 UPM30 Parity Mode Bit 0 This bit enable and set type of parity generation and check. If enabled, the transmitter will automatically generate and send the parity of the transmitted data bits within each frame. The receiver will generate a parity value for the incoming data and compare it to the UPM0 setting. If a mismatch is detected, the PE flag in UCSR0A will be set. RW 0 USBS3 Stop Bit Select 0: 1-bit. 1: 2-bit. RW 0 UCSZ31 Character Size Character Size: 0 0 0 = 5-bit. 0 0 1 = 6-bit. 0 1 0 = 7 bit. 0 1 1 = 8-bit. 1 1 1 = 9 bit. RW 1 UCSZ30 Character Size Character Size: 0 0 0 = 5-bit. 0 0 1 = 6-bit. 0 1 0 = 7 bit. 0 1 1 = 8-bit. 1 1 1 = 9 bit. RW 1 UCPOL3 Clock Polarity This bit is used for synchronous mode only. Write this bit to zero when asynchronous mode is used. The UCPOL bit sets the relationship between data output change and data input sample, and the synchronous clock (XCK). RW 0 UBRR3H USART Baud Rate Register High Byte This is a 12-bit register which contains the USART baud rate. The UBRR0H contains the 4 most significant bits, and the UBRR0L contains the 8 least significant bits of the USART baud rate. Ongoing transmissions by the transmitter and receiver will be corrupted if the baud rate is changed. Writing UBRR0L will trigger an immediate update of the baud rate prescaler. NA $135 io_com.bmp N UBRR11 USART Baud Rate Register bit 11 RW 0 UBRR10 USART Baud Rate Register bit 10 RW 0 UBRR9 USART Baud Rate Register bit 9 RW 0 UBRR8 USART Baud Rate Register bit 8 RW 0 UBRR3L USART Baud Rate Register Low Byte This is a 12-bit register which contains the USART baud rate. The UBRR0H contains the 4 most significant bits, and the UBRR0L contains the 8 least significant bits of the USART baud rate. Ongoing transmissions by the transmitter and receiver will be corrupted if the baud rate is changed. Writing UBRR0L will trigger an immediate update of the baud rate prescaler. NA $134 io_com.bmp N UBRR7 USART Baud Rate Register bit 7 RW 0 UBRR6 USART Baud Rate Register bit 6 RW 0 UBRR5 USART Baud Rate Register bit 5 RW 0 UBRR4 USART Baud Rate Register bit 4 RW 0 UBRR3 USART Baud Rate Register bit 3 RW 0 UBRR2 USART Baud Rate Register bit 2 RW 0 UBRR1 USART Baud Rate Register bit 1 RW 0 UBRR0 USART Baud Rate Register bit 0 RW 0 [SIMULATOR:STK500_2:JTAGICEmkII:AVRISPmkII] AVRSimCoreV2.SimCoreV2 AVRSimMemory8bit.SimMemory8bit AVRSimInterrupt.SimInterrupt 0x3c 0 35 AVRSimIOPort.SimIOPort Y AVRSimIOPort.SimIOPort Y AVRSimIOPort.SimIOPort Y AVRSimIOPort.SimIOPort Y AVRSimIOPort.SimIOPort Y AVRSimIOPort.SimIOPort Y AVRSimIOPort.SimIOPort Y AVRSimIOPort.SimIOPort Y AVRSimIOPort.SimIOPort Y AVRSimIOPort.SimIOPort Y AVRSimIOPort.SimIOPort Y AVRSimIOPinChangeInterrupt.SimIOPinChangeInterrupt 0x12 0x48 0x01 0x1B 0x01 0x4b 0x03 0xff AVRSimIOPinChangeInterrupt.SimIOPinChangeInterrupt 0x14 0x48 0x02 0x1B 0x02 0xe3 0xff 0x4c AVRSimIOPinChangeInterrupt.SimIOPinChangeInterrupt 0x16 0x48 0x04 0x1B 0x04 0xe6 0xff 0x4d AVRSimIOExtInterrupt.SimIOExtInterrupt 0x02 0x1d 0x01 0x1c 0x01 0x09 0x01 0x49 0x03 AVRSimIOExtInterrupt.SimIOExtInterrupt 0x04 0x1d 0x02 0x1c 0x02 0x09 0x02 0x49 0x0c AVRSimIOExtInterrupt.SimIOExtInterrupt 0x06 0x1d 0x04 0x1c 0x04 0x09 0x04 0x49 0x30 AVRSimIOExtInterrupt.SimIOExtInterrupt 0x08 0x1d 0x08 0x1c 0x08 0x09 0x08 0x49 0xc0 AVRSimIOExtInterrupt.SimIOExtInterrupt 0x0a 0x1d 0x10 0x1c 0x10 0x0C 0x10 0x4a 0x03 AVRSimIOExtInterrupt.SimIOExtInterrupt 0x0c 0x1d 0x20 0x1c 0x20 0x0C 0x20 0x4a 0x0c AVRSimIOExtInterrupt.SimIOExtInterrupt 0x0e 0x1d 0x40 0x1c 0x40 0x0C 0x40 0x4a 0x30 AVRSimIOExtInterrupt.SimIOExtInterrupt 0x10 0x1d 0x80 0x1c 0x80 0x0C 0x80 0x4a 0xc0 AvrSimIOtim8pwmsync2.tim8pwmsync2 0x2A 0x2C 0x2E PORTB 7 PORTG 5 AvrMasterTimer.MasterTimer 0x20 0x22 0x24 0x26 0x28 0x09 0x40 0x09 0x10 0x05 0x20 0x05 0x40 0x05 0x80 TIFR1/OCF1A TIFR1/OCF1B TIFR1/OCF1C 1:8:64:256:1024 0x23 0x01 AvrMasterTimer.MasterTimer 0x1a 0x1c 0x1e PORTB 4 PORTH 6 1:8:64:256:1024 AvrMasterTimer.MasterTimer 0x3E 0x40 0x42 0x44 0x46 0x0C 0x40 0x0C 0x80 0x0e 0x08 0x0e 0x10 0x0e 0x20 TIFR3/OCF3A TIFR3/OCF3B TIFR3/OCF3C 1:8:64:256:1024 0x23 0x01 AvrMasterTimer.MasterTimer 0x52 0x54 0x56 0x58 0x5a 0xe2 0x80 0xe9 0x01 0xe0 0x10 0xe0 0x20 0xe0 0x40 TIFR4/OCF4A TIFR4/OCF4B TIFR4/OCF4C 1:8:64:256:1024 0x23 0x01 AvrMasterTimer.MasterTimer 0x5c 0x5e 0x60 0x62 0x64 0xe9 0x04 0xe9 0x02 0xe9 0x80 0xe9 0x10 0xe9 0x20 TIFR5/OCF5A TIFR5/OCF5B TIFR5/OCF5C 1:8:64:256:1024 0x23 0x01 AVRSimIOSPM.SimIOSPM 0x50 AVRSimIOSpi.SimIOSpi 0x30 0x03 0x02 0x03 0x08 0x03 0x04 0x03 0x04 0x01 AVRSimIOUsart.SimIOUsart 0x32 0x36 0x34 0x0c 0x02 0x0c 0x01 AVRSimIOUsart.SimIOUsart 0x48 0x4C 0x4A 0x09 0x08 0x09 0x04 AVRSimIOUsart.SimIOUsart 0x66 0x6a 0x68 0xe0 0x02 0xe0 0x01 AVRSimIOUsart.SimIOUsart 0x6c 0x70 0x6e 0xe3 0x02 0xe3 0x01 AVRSimAC.SimIOAC 0x38 AVRSimADC.SimADC 0x3A AvrSimTWI.SimTWI 0x4E AvrMasterTimer.MasterTimer 0 16384:32768:65536:131072:262144:524288:1048576:2097152 0xFF 0xff 0xFF 0xFF 2001002532030x53115510x41256100x400x4C0x000x000x000x418100xC10xC20x000x000x0025625644440x0E 0x1E 0x0F 0x1F 0x2E 0x3E 0x2F 0x3F 0x4E 0x5E 0x4F 0x5F 0x6E 0x7E 0x6F 0x7F 0x66 0x76 0x67 0x77 0x6A 0x7A 0x6B 0x7B 0xBE 0xFD 0x00 0x01 0x00 0x00 0x00 0x021000511510151501050x0125625650x072562560505 0x0980103F JTAG 0xFF,0xFF,0xFF,0xFF,0xFF,0x3D,0xB9,0xF8 0xFF,0xFF,0x1F,0xE0,0xFF,0x1D,0xA9,0xF8 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00 0x73,0xFF,0x3F,0xFF,0xF7,0x3F,0xF7,0x3F,0xF7,0x3F,0x5F,0x3F,0x37,0x37,0x37,0x00,0x00,0x00,0x00,0x00,0xFF,0x0F,0x00,0x00,0xF7, 0x3F, 0x37 0x73,0xFF,0x3F,0xF8,0xF7,0x3F,0xF7,0x3F,0xF7,0x3F,0x5F,0x2F,0x36,0x36,0x36,0x00,0x00,0x00,0x00,0x00,0xFF,0x0F,0x00,0x00,0xF7, 0x3F, 0x36 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x31 0x57 0x3B 256 8 0x1FE00 0x1FE00 0x1FC00 0x1F800 0x1F000 0x136 0x40000 0x0000,32 0x0020,64 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3e 0x3d 0x00 0x00 0x00 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x3f