.


:




:

































 

 

 

 


.




.

 

AVR Mega , , . . , , . ( EEPROM) .

AVR Mega . . AVR 16- , , 16- . $ , .

 


 

 

Mega

 

 

.

 

, . , .

(FLASH-). , (16 ), 16- . , 4 (4x1024) 64 (64x1024) 16- . Mega : . (), . , .

(Program Counter PC). 11 17 , .

$0000 . () ( ). $0001 ( 8 ) $0002 ( ) . .

, . . (8 ) (rjmp), (jmp).

Mega / . , , .

, $0001.

, , . LPM ELPM ( , 128 ). LPM , , Z. 15 (0...32), , : 0 , 1 (. -). ELPM, LPM, 16 . / RAMPZ 15 Z. Z - , (. -). , RAMPZ 128 RAMPZ0, 256 RAMPZ1 RAMPZ0. RAMPZ 0.

RAMPZ $3 ($5) / ATmegal28x ATmegal28xx/256xx, .

 

 

 

LPM () ELPM ()

 

RAMPZ

 

 

FLASH-, AVR, , , 10 000 / ( 100 000 ).


 

.

 

Mega : , ( ) (EEPROM).

32 (), , / (). (extended) / (). 64 , 160 416 ( ).

/ ( , . .), , . .

512 8 . , , 64 .

, ( , , . .), EEPROM-. 256 4 . , .

.

 

AVR Mega . 512 8 (. ).

, 96 (256) . 512/1/2/4...64 .

 

 

 

.

 

, . AVR 32 , 8- , W (). -, -. ( ) ( , ) .

 

 

6 (R26... R31) 16- X, Y Z (. ), .

. , , . AVR, .

/.

 

/ : , ( /).

AVR / / 64 . Mega / 160 416 . , , , 64- .

/ ( , ) , , . / , , .

. , , . , , , ( ).


 

/ ATmega8515x


/ ATmega8515x ()


/

 

// CodeVisionAVR C Compiler

// (C) 1998-2002 Pavel Haiduc, HP InfoTech S.R.L.

 

// I/O registers definitions for the ATmega8515 (L)

 

#ifndef _MEGA8515_INCLUDED_

#define _MEGA8515_INCLUDED_

 

#pragma used+

sfrb OSCCAL=4;

sfrb PINE=5;

sfrb DDRE=6;

sfrb PORTE=7;

sfrb ACSR=8;

sfrb UBRRL=9;

sfrb UCSRB=0xa;

sfrb UCSRA=0xb;

sfrb UDR=0xc;

sfrb SPCR=0xd;

sfrb SPSR=0xe;

sfrb SPDR=0xf;

sfrb PIND=0x10;

sfrb DDRD=0x11;

sfrb PORTD=0x12;

sfrb PINC=0x13;

sfrb DDRC=0x14;

sfrb PORTC=0x15;

sfrb PINB=0x16;

sfrb DDRB=0x17;

sfrb PORTB=0x18;

sfrb PINA=0x19;

sfrb DDRA=0x1a;

sfrb PORTA=0x1b;

sfrb EECR=0x1c;

sfrb EEDR=0x1d;

sfrb EEARL=0x1e;

sfrb EEARH=0x1f;

sfrw EEAR=0x1e; // 16 bit access

sfrb UBRRH=0x20;

sfrb UCSRC=0x20;

sfrb WDTCR=0x21;

sfrb ICR1L=0x24;

sfrb ICR1H=0x25;

sfrw ICR1=0x24; // 16 bit access

sfrb OCR1BL=0x28;

sfrb OCR1BH=0x29;

sfrw OCR1B=0x28; // 16 bit access

sfrb OCR1AL=0x2a;

sfrb OCR1AH=0x2b;

sfrw OCR1A=0x2a; // 16 bit access

sfrb TCNT1L=0x2c;

sfrb TCNT1H=0x2d;

sfrw TCNT1=0x2c; // 16 bit access

sfrb TCCR1B=0x2e;

sfrb TCCR1A=0x2f;

sfrb SFIOR=0x30;

sfrb OCR0=0x31;

sfrb TCNT0=0x32;

sfrb TCCR0=0x33;

sfrb MCUCSR=0x34;

sfrb MCUCR=0x35;

sfrb EMCUCR=0x36;

sfrb SPMCR=0x37;

sfrb TIFR=0x38;

sfrb TIMSK=0x39;

sfrb GIFR=0x3a;

sfrb GICR=0x3b;

sfrb SPL=0x3d;

sfrb SPH=0x3e;

sfrb SREG=0x3f;

#pragma used-

 

// Interrupt vectors definitions

 

#define EXT_INT0 2

#define EXT_INT1 3

#define TIM1_CAPT 4

#define TIM1_COMPA 5

#define TIM1_COMPB 6

#define TIM1_OVF 7

#define TIM0_OVF 8

#define SPI_STC 9

#define USART_RXC 10

#define USART_UDRE 11

#define USART_TXC 12

#define ANA_COMP 13

#define EXT_INT2 14

#define TIM0_COMP 15

#define EE_RDY 16

#define SPM_RDY 17

 

// Needed by the power management functions (sleep.h)

#define __SLEEP_SUPPORTED__

#define __STANDBY_SUPPORTED__

#define __POWERDOWN_SUPPORTED__

#asm

#ifndef __SLEEP_DEFINED__

#define __SLEEP_DEFINED__

.EQU __se_bit=0x20

.SET power_ctrl_reg=mcucr

#endif

#endasm

 

#endif


// CodeVisionAVR C Compiler

// (C) 1998-2003 Pavel Haiduc, HP InfoTech S.R.L.

 

// I/O registers definitions for the ATmega8535 (L)

 

#ifndef _MEGA8535_INCLUDED_

#define _MEGA8535_INCLUDED_

 

#pragma used+

sfrb TWBR=0;

sfrb TWSR=1;

sfrb TWAR=2;

sfrb TWDR=3;

sfrb ADCL=4;

sfrb ADCH=5;

sfrw ADCW=4; // 16 bit access

sfrb ADCSRA=6;

sfrb ADMUX=7;

sfrb ACSR=8;

sfrb UBRRL=9;

sfrb UCSRB=0xa;

sfrb UCSRA=0xb;

sfrb UDR=0xc;

sfrb SPCR=0xd;

sfrb SPSR=0xe;

sfrb SPDR=0xf;

sfrb PIND=0x10;

sfrb DDRD=0x11;

sfrb PORTD=0x12;

sfrb PINC=0x13;

sfrb DDRC=0x14;

sfrb PORTC=0x15;

sfrb PINB=0x16;

sfrb DDRB=0x17;

sfrb PORTB=0x18;

sfrb PINA=0x19;

sfrb DDRA=0x1a;

sfrb PORTA=0x1b;

sfrb EECR=0x1c;

sfrb EEDR=0x1d;

sfrb EEARL=0x1e;

sfrb EEARH=0x1f;

sfrw EEAR=0x1e; // 16 bit access

sfrb UBRRH=0x20;

sfrb UCSRC=0X20;

sfrb WDTCR=0x21;

sfrb ASSR=0x22;

sfrb OCR2=0x23;

sfrb TCNT2=0x24;

sfrb TCCR2=0x25;

sfrb ICR1L=0x26;

sfrb ICR1H=0x27;

sfrb OCR1BL=0x28;

sfrb OCR1BH=0x29;

sfrw OCR1B=0x28; // 16 bit access

sfrb OCR1AL=0x2a;

sfrb OCR1AH=0x2b;

sfrw OCR1A=0x2a; // 16 bit access

sfrb TCNT1L=0x2c;

sfrb TCNT1H=0x2d;

sfrw TCNT1=0x2c; // 16 bit access

sfrb TCCR1B=0x2e;

sfrb TCCR1A=0x2f;

sfrb SFIOR=0x30;

sfrb OSCCAL=0x31;

sfrb OCDR=0x31;

sfrb TCNT0=0x32;

sfrb TCCR0=0x33;

sfrb MCUCSR=0x34;

sfrb MCUCR=0x35;

sfrb TWCR=0x36;

sfrb SPMCR=0x37;

sfrb TIFR=0x38;

sfrb TIMSK=0x39;

sfrb GIFR=0x3a;

sfrb GICR=0x3b;

sfrb OCR0=0X3c;

sfrb SPL=0x3d;

sfrb SPH=0x3e;

sfrb SREG=0x3f;

#pragma used-

 

// Interrupt vectors definitions

 

#define EXT_INT0 2

#define EXT_INT1 3

#define TIM2_COMP 4

#define TIM2_OVF 5

#define TIM1_CAPT 6

#define TIM1_COMPA 7

#define TIM1_COMPB 8

#define TIM1_OVF 9

#define TIM0_OVF 10

#define SPI_STC 11

#define USART_RXC 12

#define USART_DRE 13

#define USART_TXC 14

#define ADC_INT 15

#define EE_RDY 16

#define ANA_COMP 17

#define TWI 18

#define EXT_INT2 19

#define TIM0_COMP 20

#define SPM_READY 21

 

// Needed by the power management functions (sleep.h)

#define __SLEEP_SUPPORTED__

#define __POWERDOWN_SUPPORTED__

#define __POWERSAVE_SUPPORTED__

#define __STANDBY_SUPPORTED__

#define __EXTENDED_STANDBY_SUPPORTED__

#asm

#ifndef __SLEEP_DEFINED__

#define __SLEEP_DEFINED__

.EQU __se_bit=0x40

.EQU __sm_mask=0xB0

.EQU __sm_powerdown=0x20

.EQU __sm_powersave=0x30

.EQU __sm_standby=0xA0

.EQU __sm_ext_standby=0xB0

.EQU __sm_adc_noise_red=0x10

.SET power_ctrl_reg=mcucr

#endif

#endasm

 

#endif


// CodeVisionAVR C Compiler

// (C) 1998-2004 Pavel Haiduc, HP InfoTech S.R.L.

 

// I/O registers definitions for the ATmega88 (V)

 

#ifndef _MEGA88_INCLUDED_

#define _MEGA88_INCLUDED_

 

#pragma used+

sfrb PINB=3;

sfrb DDRB=4;

sfrb PORTB=5;

sfrb PINC=6;

sfrb DDRC=7;

sfrb PORTC=8;

sfrb PIND=9;

sfrb DDRD=0xa;

sfrb PORTD=0xb;

sfrb TIFR0=0x15;

sfrb TIFR1=0x16;

sfrb TIFR2=0x17;

sfrb PCIFR=0x1b;

sfrb EIFR=0x1c;

sfrb EIMSK=0x1d;

sfrb GPIOR0=0x1e;

sfrb EECR=0x1f;

sfrb EEDR=0x20;

sfrb EEARL=0x21;

sfrb EEARH=0x22;

sfrw EEAR=0x21; // 16 bit access

sfrb GTCCR=0x23;

sfrb TCCR0A=0x24;

sfrb TCCR0B=0x25;

sfrb TCNT0=0x26;

sfrb OCR0A=0x27;

sfrb OCR0B=0x28;

sfrb GPIOR1=0x2a;

sfrb GPIOR2=0x2b;

sfrb SPCR=0x2c;

sfrb SPSR=0x2d;

sfrb SPDR=0x2e;

sfrb ACSR=0x30;

sfrb MONDR=0x31;

sfrb SMCR=0x33;

sfrb MCUSR=0x34;

sfrb MCUCR=0x35;

sfrb SPMCSR=0x37;

sfrb SPL=0x3d;

sfrb SPH=0x3e;

sfrb SREG=0x3f;

#pragma used-

 

#define WDTCSR (*(unsigned char *) 0x60)

#define CLKPR (*(unsigned char *) 0x61)

#define PRR (*(unsigned char *) 0x64)

#define OSCCAL (*(unsigned char *) 0x66)

#define PCICR (*(unsigned char *) 0x68)

#define EICRA (*(unsigned char *) 0x69)

#define PCMSK0 (*(unsigned char *) 0x6b)

#define PCMSK1 (*(unsigned char *) 0x6c)

#define PCMSK2 (*(unsigned char *) 0x6d)

#define TIMSK0 (*(unsigned char *) 0x6e)

#define TIMSK1 (*(unsigned char *) 0x6f)

#define TIMSK2 (*(unsigned char *) 0x70)

#define ADCL (*(unsigned char *) 0x78)

#define ADCH (*(unsigned char *) 0x79)

#define ADCW (*(unsigned int *) 0x78) // 16 bit access

#define ADCSRA (*(unsigned char *) 0x7a)

#define ADCSRB (*(unsigned char *) 0x7b)

#define ADMUX (*(unsigned char *) 0x7c)

#define DIDR0 (*(unsigned char *) 0x7e)

#define DIDR1 (*(unsigned char *) 0x7f)

#define TCCR1A (*(unsigned char *) 0x80)

#define TCCR1B (*(unsigned char *) 0x81)

#define TCCR1C (*(unsigned char *) 0x82)

#define TCNT1L (*(unsigned char *) 0x84)

#define TCNT1H (*(unsigned char *) 0x85)

#define ICR1L (*(unsigned char *) 0x86)

#define ICR1H (*(unsigned char *) 0x87)

#define OCR1AL (*(unsigned char *) 0x88)

#define OCR1AH (*(unsigned char *) 0x89)

#define OCR1BL (*(unsigned char *) 0x8a)

#define OCR1BH (*(unsigned char *) 0x8b)

#define TCCR2A (*(unsigned char *) 0xb0)

#define TCCR2B (*(unsigned char *) 0xb1)

#define TCNT2 (*(unsigned char *) 0xb2)

#define OCR2A (*(unsigned char *) 0xb3)

#define OCR2B (*(unsigned char *) 0xb4)

#define ASSR (*(unsigned char *) 0xb6)

#define TWBR (*(unsigned char *) 0xb8)

#define TWSR (*(unsigned char *) 0xb9)

#define TWAR (*(unsigned char *) 0xba)

#define TWDR (*(unsigned char *) 0xbb)

#define TWCR (*(unsigned char *) 0xbc)

#define TWAMR (*(unsigned char *) 0xbd)

#define UCSR0A (*(unsigned char *) 0xc0)

#define UCSR0B (*(unsigned char *) 0xc1)

#define UCSR0C (*(unsigned char *) 0xc2)

#define UBRR0L (*(unsigned char *) 0xc4)

#define UBRR0H (*(unsigned char *) 0xc5)

#define UDR0 (*(unsigned char *) 0xc6)

 

// Interrupt vectors definitions

 

#define EXT_INT0 2

#define EXT_INT1 3

#define PCINT0 4

#define PCINT1 5

#define PCINT2 6

#define WDT 7

#define TIM2_COMPA 8

#define TIM2_COMPB 9

#define TIM2_OVF 10

#define TIM1_CAPT 11

#define TIM1_COMPA 12

#define TIM1_COMPB 13

#define TIM1_OVF 14

#define TIM0_COMPA 15

#define TIM0_COMPB 16

#define TIM0_OVF 17

#define SPI_STC 18

#define USART_RXC 19

#define USART_DRE 20

#define USART_TXC 21

#define ADC_INT 22

#define EE_RDY 23

#define ANA_COMP 24

#define TWI 25

#define SPM_READY 26

 

// Needed by the power management functions (sleep.h)

#define __SLEEP_SUPPORTED__

#define __POWERDOWN_SUPPORTED__

#define __POWERSAVE_SUPPORTED__

#define __STANDBY_SUPPORTED__

#asm

#ifndef __SLEEP_DEFINED__

#define __SLEEP_DEFINED__

.EQU __se_bit=0x01

.EQU __sm_mask=0x0E

.EQU __sm_adc_noise_red=0x02

.EQU __sm_powerdown=0x04

.EQU __sm_powersave=0x06

.EQU __sm_standby=0x0C

.SET power_ctrl_reg=smcr

#endif

#endasm

 

#endif

 

 


/ IN OUT, 32- /.

, /:

- / (SBI CBI);

- (SBIS SBIC).

, 1- / ( $00...$1F).

( IN OUT), ST/SD/SDD LD/LDS/LDD ( ). , / ($00...$3F). $20.

, . SREG. $3F ($5F) , . 1 0 ( ). , ; 0. , .

 

 

 

SREG

 

 

, 3 / GPIOR0, GPIOR1 GPIOR2. , SREG. GPIOR0...2 / SBI/CBI SBIS/SBIC.


SREG

 






:


: 2016-12-28; !; : 2375 |


:

:

, .
==> ...

1499 - | 1314 -


© 2015-2024 lektsii.org - -

: 0.206 .