ATmega8 (961837), страница 42

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

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

This is the compound effect of offset,gain error, differential error, non-linearity, and quantization error. Ideal value: ±0.5LSB.After the conversion is complete (ADIF is high), the conversion result can be found inthe ADC Result Registers (ADCL, ADCH).For single ended conversion, the result isV IN ⋅ 1024ADC = -------------------------V REFwhere VIN is the voltage on the selected input pin and VREF the selected voltage reference (see Table 74 on page 203 and Table 75 on page 203). 0x000 represents ground,and 0x3FF represents the selected reference voltage minus one LSB.ADC Multiplexer SelectionRegister – ADMUXBit76543210REFS1REFS0ADLAR–MUX3MUX2MUX1MUX0Read/WriteR/WR/WR/WRR/WR/WR/WR/WInitial Value00000000ADMUX• Bit 7:6 – REFS1:0: Reference Selection BitsThese bits select the voltage reference for the ADC, as shown in Table 74.

If these bitsare changed during a conversion, the change will not go in effect until this conversion iscomplete (ADIF in ADCSRA is set). The internal voltage reference options may not beused if an external reference voltage is being applied to the AREF pin.202ATmega8(L)2486O–AVR–10/04ATmega8(L)Table 74. Voltage Reference Selections for ADC•REFS1REFS0Voltage Reference Selection00AREF, Internal Vref turned off01AVCC with external capacitor at AREF pin10Reserved11Internal 2.56V Voltage Reference with external capacitor at AREF pinBit 5 – ADLAR: ADC Left Adjust ResultThe ADLAR bit affects the presentation of the ADC conversion result in the ADC DataRegister. Write one to ADLAR to left adjust the result.

Otherwise, the result is rightadjusted. Changing the ADLAR bit will affect the ADC Data Register immediately,regardless of any ongoing conversions. For a complete description of this bit, see “TheADC Data Register – ADCL and ADCH” on page 205.• Bits 3:0 – MUX3:0: Analog Channel Selection BitsThe value of these bits selects which analog inputs are connected to the ADC. SeeTable 75 for details. If these bits are changed during a conversion, the change will notgo in effect until this conversion is complete (ADIF in ADCSRA is set).Table 75.

Input Channel SelectionsMUX3..0Single Ended Input0000ADC00001ADC10010ADC20011ADC30100ADC40101ADC50110ADC60111ADC710001001101010111100110111101.23V (VBG)11110V (GND)2032486O–AVR–10/04ADC Control and StatusRegister A – ADCSRABit76543210ADENADSCADFRADIFADIEADPS2ADPS1ADPS0Read/WriteR/WR/WR/WR/WR/WR/WR/WR/WInitial Value00000000ADCSRA• Bit 7 – ADEN: ADC EnableWriting this bit to one enables the ADC. By writing it to zero, the ADC is turned off. Turning the ADC off while a conversion is in progress, will terminate this conversion.• Bit 6 – ADSC: ADC Start ConversionIn Single Conversion mode, write this bit to one to start each conversion.

In Free Running mode, write this bit to one to start the first conversion. The first conversion afterADSC has been written after the ADC has been enabled, or if ADSC is written at thesame time as the ADC is enabled, will take 25 ADC clock cycles instead of the normal13. This first conversion performs initialization of the ADC.ADSC will read as one as long as a conversion is in progress.

When the conversion iscomplete, it returns to zero. Writing zero to this bit has no effect.• Bit 5 – ADFR: ADC Free Running SelectWhen this bit is set (one) the ADC operates in Free Running mode. In this mode, theADC samples and updates the Data Registers continuously. Clearing this bit (zero) willterminate Free Running mode.• Bit 4 – ADIF: ADC Interrupt FlagThis bit is set 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 inSREG are set.

ADIF is cleared by hardware when executing the corresponding interruptHandling Vector. Alternatively, ADIF is cleared by writing a logical one to the flag.Beware that if doing a Read-Modify-Write on ADCSRA, a pending interrupt can be disabled. This also applies if the SBI and CBI instructions are used.• Bit 3 – ADIE: ADC Interrupt EnableWhen this bit is written to one and the I-bit in SREG is set, the ADC Conversion Complete Interrupt is activated.204ATmega8(L)2486O–AVR–10/04ATmega8(L)• Bits 2:0 – ADPS2:0: ADC Prescaler Select BitsThese bits determine the division factor between the XTAL frequency and the inputclock to the ADC.Table 76.

ADC Prescaler SelectionsADPS2ADPS1ADPS0Division Factor0002001201040118100161013211064111128The ADC Data Register – ADCL and ADCHADLAR = 0BitRead/WriteInitial Value15141312111098––––––ADC9ADC8ADCHADC7ADC6ADC5ADC4ADC3ADC2ADC1ADC0ADCL76543210RRRRRRRRRRRRRRRR0000000000000000ADLAR = 1BitRead/WriteInitial Value15141312111098ADC9ADC8ADC7ADC6ADC5ADC4ADC3ADC2ADCHADC1ADC0––––––ADCL76543210RRRRRRRRRRRRRRRR0000000000000000When an ADC conversion is complete, the result is found in these two registers.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 is required, it issufficient to read ADCH. Otherwise, ADCL must be read first, then ADCH.The ADLAR bit in ADMUX, and the MUXn bits in ADMUX affect the way the result isread from the registers. If ADLAR is set, the result is left adjusted. If ADLAR is cleared(default), the result is right adjusted.• ADC9:0: ADC Conversion resultThese bits represent the result from the conversion, as detailed in “ADC ConversionResult” on page 202.2052486O–AVR–10/04Boot Loader Support– Read-While-WriteSelf-ProgrammingThe Boot Loader Support provides a real Read-While-Write Self-Programming mechanism for downloading and uploading program code by the MCU itself.

This featureallows flexible application software updates controlled by the MCU using a Flash-resident Boot Loader program. The Boot Loader program can use any available datainterface and associated protocol to read code and write (program) that code into theFlash memory, or read the code from the Program memory.

The program code withinthe Boot Loader section has the capability to write into the entire Flash, including theBoot Loader Memory. The Boot Loader can thus even modify itself, and it can alsoerase itself from the code if the feature is not needed anymore. The size of the BootLoader Memory is configurable with fuses and the Boot Loader has two separate sets ofBoot Lock Bits which can be set independently. This gives the user a unique flexibility toselect different levels of protection.Boot Loader Features•••••••Read-While-Write Self-ProgrammingFlexible Boot Memory SizeHigh Security (Separate Boot Lock Bits for a Flexible Protection)Separate Fuse to Select Reset VectorOptimized Page(1) SizeCode Efficient AlgorithmEfficient Read-Modify-Write SupportNote:1.

A page is a section in the Flash consisting of several bytes (see Table 89 on page222) used during programming. The page organization does not affect normaloperation.Application and BootLoader Flash SectionsThe Flash memory is organized in two main sections, the Application section and theBoot loader section (see Figure 102). The size of the different sections is configured bythe BOOTSZ Fuses as shown in Table 82 on page 217 and Figure 102. These two sections can have different level of protection since they have different sets of Lock Bits.Application SectionThe application section is the section of the Flash that is used for storing the applicationcode.

The protection level for the application section can be selected by the applicationboot Lock Bits (Boot Lock Bits 0), see Table 78 on page 209. The application sectioncan never store any Boot Loader code since the SPM instruction is disabled when executed from the application section.BLS – Boot Loader SectionWhile the application section is used for storing the application code, the The BootLoader software must be located in the BLS since the SPM instruction can initiate a programming when executing from the BLS only.

The SPM instruction can access theentire Flash, including the BLS itself. The protection level for the Boot Loader sectioncan be selected by the Boot Loader Lock Bits (Boot Lock Bits 1), see Table 79 on page209.Read-While-Write and No Whether the CPU supports Read-While-Write or if the CPU is halted during a BootLoader software update is dependent on which address that is being programmed. InRead-While-Write Flashaddition to the two sections that are configurable by the BOOTSZ Fuses as describedSectionsabove, the Flash is also divided into two fixed sections, the Read-While-Write (RWW)section and the No Read-While-Write (NRWW) section. The limit between the RWWand NRWW sections is given in Table 83 on page 218 and Figure 102 on page 208.

Themain difference between the two sections is:206•When erasing or writing a page located inside the RWW section, the NRWW sectioncan be read during the operation.•When erasing or writing a page located inside the NRWW section, the CPU is haltedduring the entire operation.ATmega8(L)2486O–AVR–10/04ATmega8(L)Note that the user software can never read any code that is located inside the RWWsection during a Boot Loader software operation. The syntax “Read-While-Write section” refers to which section that is being programmed (erased or written), not whichsection that actually is being read during a Boot Loader software update.RWW – Read-While-WriteSectionIf a Boot Loader software update is programming a page inside the RWW section, it ispossible to read code from the Flash, but only code that is located in the NRWW section.

During an on-going programming, the software must ensure that the RWW sectionnever is being read. If the user software is trying to read code that is located inside theRWW section (i.e. by a call/rjmp/lpm or an interrupt) during programming, the softwaremight end up in an unknown state. To avoid this, the interrupts should either be disabledor moved to the Boot Loader Section. The Boot Loader Section is always located in theNRWW section. The RWW Section Busy bit (RWWSB) in the Store Program memoryControl Register (SPMCR) will be read as logical one as long as the RWW section isblocked for reading.

After a programming is completed, the RWWSB must be cleared bysoftware before reading code located in the RWW section. See “Store Program MemoryControl Register – SPMCR” on page 210. for details on how to clear RWWSB.NRWW – No Read-While-WriteSectionThe code located in the NRWW section can be read when the Boot Loader software isupdating a page in the RWW section. When the Boot Loader code updates the NRWWsection, the CPU is halted during the entire page erase or page write operation.Table 77.

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

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

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

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