Файл: Beginers introduction to the Assebly Language of ATMEL-AVR Microprocessors (Gerhard Schmidt,2004, англ).pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 13.06.2025

Просмотров: 601

Скачиваний: 1

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

Avr-Asm-Tutorial

47

http://www.avr-asm-tutorial.net

Bit

Name

Meaning

Opportunities

7

TOIE1

Timer/Counter 1 Overflow-Interrupt

0: No Int at overflow

1: Int at overflow

6

OCIE1A

Timer/Counter 1 Compare A Interrupt

0: No Int at equal A

1: Int at equal A

5

OCIE1B

Timer/Counter 1 Compare B Interrupt

0: No Int at B

1: Int at equal B

4

(Not used)

3

TICIE1

Timer/Counter 1 Capture Interrupt

0: No Int at Capture

1: Int at Capture

2

(Not used)

1

TOIE0

Timer/Counter 0 Overflow-Interrupt

0: No Int at overflow

1: Int at overflow

0

(Not used)

Port

Function

Port-Address

RAM-Address

TIFR

Timer Interrupt Flag Register

0x38

0x58

7

6

5

4

3

2

1

0

TOV1

OCF1A

OCF1B

-

ICF1

-

TOV0

-

Bit

Name

Meaning

Opportunities

7

TOV1

Timer/Counter 1 Overflow reached

Interrupt-Mode:

6

OCF1A

Timer/Counter 1 Compare A reached

Automatic Clear

by execution of the

5

OCF1B

Timer/Counter 1 Compare B reached

Int-Routine

4

(Not used)

OR

3

ICF1

Timer/Counter 1 Capture-Event occured

2

(not used)

Polling-Mode:

1

TOV0

Timer/Counter 0 Overflow occured

Clear by

command

0

(not used)

Timer/Counter 0

Port

Function

Port-Address

RAM-Address

TCCR0

Timer/Counter 0 Control Register

0x33

0x53

7

6

5

4

3

2

1

0

-

-

-

-

-

CS02

CS01

CS00

Bit

Name

Meaning

Opportunities

000: Stop Timer

001: Clock = Chip clock

010: Clock = Chip clock / 8

2..0

CS02..CS00

Timer Clock

011: Clock = Chip clock / 64

100: Clock = Chip clock / 256

101: Clock = Chip clock / 1024

110: Clock = falling edge of external Pin T0

111: Clock = rising edge of external Pin T0

3..7

(not used)


Avr-Asm-Tutorial

48

http://www.avr-asm-tutorial.net

Port

Function

Port-Address

RAM-Address

TCNT0

Timer/Counter 0 count register

0x32

0x52

Timer/Counter 1

Port

Function

Port-Address

RAM-Address

TCCR1A

Timer/Counter 1 Control Register A

0x2F

0x4F

7

6

5

4

3

2

1

0

COM1A1

COM1A0

COM1B1

COM1B0

-

-

PWM11

PWM10

Bit

Name

Meaning

Opportunities

7

COM1A1

Compare Output A

00: OC1A/B not connected

6

COM1A0

01: OC1A/B changes polarity

10: OC1A/B to zero

5

COM1B1

Compare Output B

11: OC1A/B to one

4

COM1B0

3

(not used)

2

00: PWM off

1..0

PWM11

Pulse width modulator

01: 8-Bit PWM

PWM10

10: 9-Bit PWM

11: 10-Bit PWM

Port

Function

Port-Address

RAM-Address

TCCR1B

Timer/Counter 1 Control Register B

0x2E

0x4E

7

6

5

4

3

2

1

0

ICNC1

ICES1

-

-

CTC1

CS12

CS11

CS10

Bit

Name

Meaning

Opportunities

7

ICNC1

Noise Canceler

0: disabled, first edge starts sampling

on ICP-Pin

1: enabled, min four clock cycles

6

ICES1

Edge selection

0: falling edge triggers Capture

on Capture

1: rising edge triggers Capture

5..4

(not used)

3

CTC1

Clear at

1: Counter set to zero if equal

Compare Match A

000: Counter stopped

001: Clock

010: Clock / 8

2..0

CS12..CS10

Clock select

011: Clock / 64

100: Clock / 256

101: Clock / 1024

110: falling edge external Pin T1

111: rising edge external Pin T1

Port

Function

Port-Address

RAM-Address

TCNT1L/H

Timer/Counter 1 count register

0x2C/0x2D

0x4C/0x4D


Avr-Asm-Tutorial

49

http://www.avr-asm-tutorial.net

Port

Function

Port-Address

RAM-Address

OCR1AL/H

Timer/Counter 1 Output Compare register A

0x2A/0x2B

0x4A/0x4B hex

Port

Function

Port-Address

RAM-Address

OCR1BL/H

Timer/Counter 1 Output Compare register B

0x28/0x29

0x48/0x49

Port

Function

Port-Address

RAM-Address

ICR1L/H

Timer/Counter 1 Input Capture Register

0x24/0x25

0x44/0x45

Watchdog­Timer

Port

Function

Port-Address

RAM-Address

WDTCR

Watchdog Timer Control Register

0x21

0x41

7

6

5

4

3

2

1

0

-

-

-

WDTOE

WDE

WDP2

WDP1

WDP0

Bit

Name

Meaning

WDT-cycle at 5.0 Volt

7..5

(not used)

4

WDTOE

Watchdog Turnoff Enable

Previous set to

disabling of WDE required

3

WDE

Watchdog Enable

1: Watchdog aktive

000: 15 ms

001: 30 ms

010: 60 ms

2..0

WDP2..WDP0

Watchdog Timer Prescaler

011: 120 ms

100: 240 ms

101: 490 ms

110: 970 ms

111: 1,9 s

EEPROM

Port

Function

Port-Address

RAM-Address

EEARL/H

EEPROM Address Register

0x1E/0x1F

0x3E/0x3F

EEARH only in types with more than 256 Bytes EEPROM (from AT90S8515 upwards)

Port

Function

Port-Address

RAM-Address

EEDR

EEPROM Data Register

0x1D

0x3D

Port

Function

Port-Address

RAM-Address

EECR

EEPROM Control Register

0x1C

0x3C

7

6

5

4

3

2

1

0

-

-

-

-

-

EEMWE

EEWE

EERE


Avr-Asm-Tutorial

50

http://www.avr-asm-tutorial.net

Bit

Name

Meaning

Function

7..

(not used)

3

2

EEMWE

EEPROM Master Write Enable

Previous set enables write cycle

1

EEWE

EEPROM Write Enable

Set to initiate write

0

EERE

EEPROM Read Enable

Set initiates read

Serial Peripheral Interface SPI

Port

Function

Port-Address

RAM-Address

SPCR

SPI Control Register

0x0D

0x2D

7

6

5

4

3

2

1

0

SPIE

SPE

DORD

MSTR

CPOL

CPHA

SPR1

SPR0

Bit

Name

Meaning

Function

7

SPIE

SPI Interrupt Enable

0: Interrupts disabled

1: Interrupts enabled

6

SPE

SPI Enable

0: SPI disabled

1: SPI enabled

5

DORD

Data Order

0: MSB first

1: LSB first

4

MSTR

Master/Slave Select

0: Slave

1: Master

3

CPOL

Clock Polarity

0: Positive Clock Phase

1: Negative Clock Phase

2

CPHA

Clock Phase

0: Sampling at beginning of Clock Phase

1: Sampling at end of Clock Phase

1

SPR1

00: Clock / 4

SCK clock frequency

01: Clock / 16

0

SPR0

10: Clock / 64

11: Clock / 128

Port

Function

Port-Address

RAM-Address

SPSR

SPI Status Register

0x0E

0x2E

7

6

5

4

3

2

1

0

SPIF

WCOL

-

-

-

-

-

-

Bit

Name

Meaning

Function

7

SPIF

SPI Interrupt Flag

Interrupt request

6

WCOL

Write Collision Flag

Write collission occured

5..0

(not used)

Port

Function

Port-Address

RAM-Address

SPDR

SPI Data Register

0x0F

0x2F


Avr-Asm-Tutorial 51 http://www.avr-asm-tutorial.net

UART

Port

Function

Port-Address

RAM-Address

UDR

UART I/O Data Register

0x0C

0x2C

Port

Function

Port-Address

RAM-Address

USR

UART Status Register

0x0B

0x2B

7

6

5

4

3

2

1

0

RXC

TXC

UDRE

FE

OR

-

-

-

Bit

Name

Meaning

Function

7

RXC

UART Receive Complete

1: Char received

6

TXC

UART Transmit Complete

1: Shift register empty

5

UDRE

UART Data Register Empty

1: Transmit register available

4

FE

Framing Error

1: Illegal Stop-Bit

3

OR

Overrun

1: Lost char

2..0

(not used)

Port

Function

Port-Address

RAM-Address

UCR

UART Control Register

0x0A

0x2A

7

6

5

4

3

2

1

0

RXCIE

TXCIE

UDRIE

RXEN

TXEN

CHR9

RXB8

TXB8

Bit

Name

Meaning

Function

7

RXCIE

RX Complete Interrupt Enable

1: Interrupt on received char

6

TXCIE

TX Complete Interrupt Enable

1: Interrupt at transmit complete

5

UDRIE

Data Register Empty Interrupt Enable

1: Interrupt on transmit buffer empty

4

RXEN

Receiver Enabled

1: Receiver enabled

3

TXEN

Transmitter Enable

1: Transmitter enabled

2

CHR9

9-bit Characters

1: Char length 9 Bit

1

RXB8

Receive Data Bit 8

9th Data bit on receive

0

TXB8

Transmit Data Bit 8

9.Data bit on transmit

Port

Function

Port-Address

RAM-Address

UBRR

UART Baud Rate Register

0x09

0x29

Analog Comparator

Port

Function

Port-Address

RAM-Address

ACSR

Analog Comparator Control and Status Register

0x08

0x28

7

6

5

4

3

2

1

0

ACD

-

ACO

ACI

ACIE

ACIC

ACIS1

ACIS0

Bit

Name

Meaning

Function

7

ACD

Disable

Disable Comparators

6

(not used)

5

ACO

Comparator Output

Read: Output of the Comparators

4

ACI

Interrupt Flag

1: Interrupt request