ATmega128 (961723), страница 3

Файл №961723 ATmega128 (Скамко) 3 страницаATmega128 (961723) страница 32013-09-29СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 3)

In addition, theATmega128 has Extended I/O space from $60 - $FF in SRAM where only theST/STS/STD and LD/LDS/LDD instructions can be used.ALU – Arithmetic LogicUnitThe high-performance AVR ALU operates in direct connection with all the 32 generalpurpose working registers. Within a single clock cycle, arithmetic operations betweengeneral purpose registers or between a register and an immediate are executed. TheALU operations are divided into three main categories – arithmetic, logical, and bit-functions. Some implementations of the architecture also provide a powerful multipliersupporting both signed/unsigned multiplication and fractional format. See the “Instruction Set” section for a detailed description.Status RegisterThe Status Register contains information about the result of the most recently executedarithmetic instruction.

This information can be used for altering program flow in order toperform conditional operations. Note that the Status Register is updated after all ALUoperations, as specified in the Instruction Set Reference. This will in many casesremove the need for using the dedicated compare instructions, resulting in faster andmore compact code.The status register is not automatically stored when entering an interrupt routine andrestored when returning from an interrupt.

This must be handled by software.The AVR status Register – SREG – is defined as:Bit76543210ITHSVNZCRead/WriteR/WR/WR/WR/WR/WR/WR/WR/WInitial Value00000000SREG• Bit 7 – I: Global Interrupt Enable92467M–AVR–11/04The Global Interrupt Enable bit must be set for the interrupts to be enabled. The individual interrupt enable control is then performed in separate control registers. If the GlobalInterrupt Enable Register is cleared, none of the interrupts are enabled independent ofthe individual interrupt enable settings. The I-bit is cleared by hardware after an interrupthas occurred, and is set by the RETI instruction to enable subsequent interrupts.

The Ibit can also be set and cleared in software with the SEI and CLI instructions, asdescribed in the instruction set reference.• Bit 6 – T: Bit Copy StorageThe Bit Copy instructions BLD (Bit LoaD) and BST (Bit STore) use the T-bit as source ordestination for the operated bit. A bit from a register in the Register file can be copiedinto T by the BST instruction, and a bit in T can be copied into a bit in a register in theRegister file by the BLD instruction.• Bit 5 – H: Half Carry FlagThe Half Carry Flag H indicates a half carry in some arithmetic operations. Half carry isuseful in BCD arithmetic.

See the “Instruction Set Description” for detailed information.• Bit 4 – S: Sign Bit, S = N⊕VThe S-bit is always an exclusive or between the negative flag N and the two’s complement overflow flag V. See the “Instruction Set Description” for detailed information.• Bit 3 – V: Two’s Complement Overflow FlagThe Two’s Complement Overflow Flag V supports two’s complement arithmetics. Seethe “Instruction Set Description” for detailed information.• Bit 2 – N: Negative FlagThe Negative Flag N indicates a negative result in an arithmetic or logic operation. Seethe “Instruction Set Description” for detailed information.• Bit 1 – Z: Zero FlagThe Zero Flag Z indicates a zero result in an arithmetic or logic operation. See the“Instruction Set Description” for detailed information.• Bit 0 – C: Carry FlagThe Carry Flag C indicates a carry in an arithmetic or logic operation.

See the “Instruction Set Description” for detailed information.General PurposeRegister FileThe Register file is optimized for the AVR Enhanced RISC instruction set. In order toachieve the required performance and flexibility, the following input/output schemes aresupported by the Register file:•One 8-bit output operand and one 8-bit result input•Two 8-bit output operands and one 8-bit result input•Two 8-bit output operands and one 16-bit result input•One 16-bit output operand and one 16-bit result inputFigure 4 shows the structure of the 32 general purpose working registers in the CPU.Figure 4. AVR CPU General Purpose Working Registers7100Addr.R0$00R1$01R2$02ATmega1282467M–AVR–11/04ATmega128…R13$0DGeneralR14$0EPurposeR15$0FWorkingR16$10RegistersR17$11…R26$1AX-register Low ByteR27$1BX-register High ByteR28$1CY-register Low ByteR29$1DY-register High ByteR30$1EZ-register Low ByteR31$1FZ-register High ByteMost of the instructions operating on the Register file have direct access to all registers,and most of them are single cycle instructions.As shown in Figure 4, each register is also assigned a data memory address, mappingthem directly into the first 32 locations of the user Data Space.

Although not being physically implemented as SRAM locations, this memory organization provides greatflexibility in access of the registers, as the X-, Y-, and Z-pointer Registers can be set toindex any register in the file.X-register, Y-register, and ZregisterThe registers R26..R31 have some added functions to their general purpose usage.These registers are 16-bit address pointers for indirect addressing of the Data Space.The three indirect address registers X, Y, and Z are described in Figure 5.Figure 5.

The X-, Y-, and Z-registers15X - registerXH7XL0R27 ($1B)15Y - registerYH7157R31 ($1F)00R26 ($1A)YL0R29 ($1D)Z - register7700R28 ($1C)ZHZL0700R30 ($1E)In the different addressing modes these address registers have functions as fixed displacement, automatic increment, and automatic decrement (see the Instruction SetReference for details).112467M–AVR–11/04Stack PointerThe Stack is mainly used for storing temporary data, for storing local variables and forstoring return addresses after interrupts and subroutine calls. The Stack Pointer Register always points to the top of the Stack.

Note that the Stack is implemented as growingfrom higher memory locations to lower memory locations. This implies that a StackPUSH command decreases the Stack Pointer.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 theprogram before any subroutine calls are executed or interrupts are enabled. The StackPointer must be set to point above $60. The Stack Pointer is decremented by one whendata is pushed onto the Stack with the PUSH instruction, and it is decremented by twowhen the return address is pushed onto the Stack with subroutine call or interrupt.

TheStack Pointer is incremented by one when data is popped from the Stack with the POPinstruction, and it is incremented by two when data is popped from the Stack with returnfrom subroutine RET or return from interrupt RETI.The AVR Stack Pointer is implemented as two 8-bit registers in the I/O space. The number of bits actually used is implementation dependent. Note that the data space in someimplementations of the AVR architecture is so small that only SPL is needed. In thiscase, the SPH Register will not be present.Bit15141312111098SP15SP14SP13SP12SP11SP10SP9SP8SPHSP7SP6SP5SP4SP3SP2SP1SP0SPL76543210Read/WriteR/WR/WR/WR/WR/WR/WR/WR/WR/WR/WR/WR/WR/WR/WR/WR/W000000000000000076543210––––––––RAMPZ0Read/WriteRRRRRRRR/WInitial Value00000000Initial ValueRAM Page Z Select Register –RAMPZBitRAMPZ• Bits 7..1 – Res: Reserved BitsThese are reserved bits and will always read as zero.

When writing to this address location, write these bits to zero for compatibility with future devices.• Bit 0 – RAMPZ0: Extended RAM Page Z-pointerThe RAMPZ Register is normally used to select which 64K RAM Page is accessed bythe Z-pointer. As the ATmega128 does not support more than 64K of SRAM memory,this register is used only to select which page in the program memory is accessed whenthe ELPM/SPM instruction is used.

The different settings of the RAMPZ0 bit have thefollowing effects:RAMPZ0 = 0:Program memory address $0000 - $7FFF (lower 64K bytes) isaccessed by ELPM/SPMRAMPZ0 = 1:Program memory address $8000 - $FFFF (higher 64K bytes) isaccessed by ELPM/SPMNote that LPM is not affected by the RAMPZ setting.12ATmega1282467M–AVR–11/04ATmega128Instruction ExecutionTimingThis section describes the general access timing concepts for instruction execution.

TheAVR CPU is driven by the CPU clock clkCPU, directly generated from the selected clocksource for the chip. No internal clock division is used.Figure 6 shows the parallel instruction fetches and instruction executions enabled by theHarvard architecture and the fast-access Register file concept. This is the basic pipelining concept to obtain up to 1 MIPS per MHz with the corresponding unique results forfunctions per cost, functions per clocks, and functions per power-unit.Figure 6. The Parallel Instruction Fetches and Instruction ExecutionsT1T2T3T4clkCPU1st Instruction Fetch1st Instruction Execute2nd Instruction Fetch2nd Instruction Execute3rd Instruction Fetch3rd Instruction Execute4th Instruction FetchFigure 7 shows the internal timing concept for the Register file.

In a single clock cycle anALU operation using two register operands is executed, and the result is stored back tothe destination register.Figure 7. Single Cycle ALU OperationT1T2T3T4clkCPUTotal Execution TimeRegister Operands FetchALU Operation ExecuteResult Write BackReset and InterruptHandlingThe AVR provides several different interrupt sources. These interrupts and the separatereset vector each have a separate program vector in the program memory space. Allinterrupts are assigned individual enable bits which must be written logic one togetherwith the Global Interrupt Enable bit in the Status Register in order to enable the interrupt.Depending on the Program Counter value, interrupts may be automatically disabledwhen Boot Lock bits BLB02 or BLB12 are programmed. This feature improves softwaresecurity.

See the section “Memory Programming” on page 288 for details.The lowest addresses in the program memory space are by default defined as the Resetand Interrupt vectors. The complete list of vectors is shown in “Interrupts” on page 57.The list also determines the priority levels of the different interrupts. The lower theaddress the higher is the priority level. RESET has the highest priority, and next is INT0– the External Interrupt Request 0.

Характеристики

Тип файла
PDF-файл
Размер
3 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов учебной работы

Свежие статьи
Популярно сейчас
Как Вы думаете, сколько людей до Вас делали точно такое же задание? 99% студентов выполняют точно такие же задания, как и их предшественники год назад. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6264
Авторов
на СтудИзбе
317
Средний доход
с одного платного файла
Обучение Подробнее