ATmega8 (961730), страница 46

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

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

The default value of SUT1..0 results in maximum start-up time. SeeTable 10 on page28 for details.2. The default setting of CKSEL3..0 results in internal RC Oscillator @ 1MHz. SeeTable 2 on page 24 for details.The status of the Fuse Bits is not affected by Chip Erase. Note that the Fuse Bits arelocked if lock bit1 (LB1) is programmed. Program the Fuse Bits before programming theLock Bits.Latching of FusesThe fuse values are latched when the device enters Programming mode and changes ofthe fuse values will have no effect until the part leaves Programming mode.

This doesnot apply to the EESAVE Fuse which will take effect once it is programmed. The fusesare also latched on Power-up in Normal mode.2212486O–AVR–10/04Signature BytesAll Atmel microcontrollers have a 3-byte signature code which identifies the device. Thiscode can be read in both Serial and Parallel mode, also when the device is locked. Thethree bytes reside in a separate address space.For the ATmega8 the signature bytes are:1. 0x000: 0x1E (indicates manufactured by Atmel).2.

0x001: 0x93 (indicates 8KB Flash memory).3. 0x002: 0x07 (indicates ATmega8 device).Calibration ByteThe ATmega8 stores four different calibration values for the internal RC Oscillator.These bytes resides in the signature row High byte of the addresses 0x0000, 0x0001,0x0002, and 0x0003 for 1, 2, 4, and 8 Mhz respectively. During Reset, the 1 MHz valueis automatically loaded into the OSCCAL Register. If other frequencies are used, thecalibration value has to be loaded manually, see “Oscillator Calibration Register – OSCCAL” on page 29 for details.Page SizeTable 89.

No. of Words in a Page and no. of Pages in the FlashFlash Size4K words (8K bytes)Page SizePCWORDNo. of PagesPCPAGEPCMSB32 wordsPC[4:0]128PC[11:5]11Table 90. No. of Words in a Page and no. of Pages in the EEPROM222EEPROM SizePage SizePCWORDNo. of PagesPCPAGEEEAMSB512 bytes4 bytesEEA[1:0]128EEA[8:2]8ATmega8(L)2486O–AVR–10/04ATmega8(L)Parallel ProgrammingParameters, PinMapping, andCommandsThis section describes how to parallel program and verify Flash Program memory,EEPROM Data memory, Memory Lock Bits, and Fuse Bits in the ATmega8. Pulses areassumed to be at least 250 ns unless otherwise noted.Signal NamesIn this section, some pins of the ATmega8 are referenced by signal names describingtheir functionality during parallel programming, see Figure 104 and Table 91. Pins notdescribed in the following table are referenced by pin names.The XA1/XA0 pins determine the action executed when the XTAL1 pin is given a positive pulse.

The bit coding is shown in Table 93.When pulsing WR or OE, the command loaded determines the action executed. The different Commands are shown in Table 94.Figure 104. Parallel Programming+5VRDY/BSYPD1OEPD2WRPD3BS1PD4XA0PD5XA1PD6PAGELPD7+12 VVCC+5VAVCCPC[1:0]:PB[5:0]DATARESETBS2PC2XTAL1GNDTable 91. Pin Name MappingSignal Name inProgramming ModePin NameI/OFunctionRDY/BSYPD1O0: Device is busy programming, 1: Deviceis ready for new commandOEPD2IOutput Enable (Active low)WRPD3IWrite Pulse (Active low)BS1PD4IByte Select 1 (“0” selects Low byte, “1”selects High byte)XA0PD5IXTAL Action Bit 0XA1PD6IXTAL Action Bit 12232486O–AVR–10/04Table 91. Pin Name Mapping (Continued)Signal Name inProgramming ModePin NameI/OFunctionPAGELPD7IProgram memory and EEPROM DataPage LoadBS2PC2IByte Select 2 (“0” selects Low byte, “1”selects 2’nd High byte)DATA{PC[1:0]: PB[5:0]}I/OBi-directional Data bus (Output when OE islow)Table 92.

Pin Values used to Enter Programming ModePinSymbolValuePAGELProg_enable[3]0XA1Prog_enable[2]0XA0Prog_enable[1]0BS1Prog_enable[0]0Table 93. XA1 and XA0 CodingXA1XA0Action when XTAL1 is Pulsed00Load Flash or EEPROM Address (High or low address byte determined by BS1)01Load Data (High or Low data byte for Flash determined by BS1)10Load Command11No Action, IdleTable 94. Command Byte Bit CodingCommand Byte224Command Executed1000 0000Chip Erase0100 0000Write Fuse Bits0010 0000Write Lock Bits0001 0000Write Flash0001 0001Write EEPROM0000 1000Read Signature Bytes and Calibration byte0000 0100Read Fuse and Lock Bits0000 0010Read Flash0000 0011Read EEPROMATmega8(L)2486O–AVR–10/04ATmega8(L)Parallel ProgrammingEnter Programming ModeThe following algorithm puts the device in Parallel Programming mode:1.

Apply 4.5 - 5.5V between VCC and GND, and wait at least 100 µs.2. Set RESET to “0” and toggle XTAL1 at least 6 times3. Set the Prog_enable pins listed in Table 92 on page 224 to “0000” and wait atleast 100 ns.4. Apply 11.5 - 12.5V to RESET. Any activity on Prog_enable pins within 100 nsafter +12V has been applied to RESET, will cause the device to fail entering Programming mode.Note, if the RESET pin is disabled by programming the RSTDISBL Fuse, it may not bepossible to follow the proposed algorithm above. The same may apply when ExternalCrystal or External RC configuration is selected because it is not possible to apply qualified XTAL1 pulses.

In such cases, the following algorithm should be followed:1. Set Prog_enable pins listed in Table 92 on page 224 to “0000”.2. Apply 4.5 - 5.5V between VCC and GND simultaneously as 11.5 - 12.5V isapplied to RESET.3. Wait 100 ns.4. Re-program the fuses to ensure that External Clock is selected as clock source(CKSEL3:0 = 0’b0000) and RESET pin is activated (RSTDISBL unprogrammed).If Lock Bits are programmed, a chip erase command must be executed beforechanging the fuses.5. Exit Programming mode by power the device down or by bringing RESET pin to0’b0.6. Entering Programming mode with the original algorithm, as described above.Considerations for EfficientProgrammingChip EraseThe loaded command and address are retained in the device during programming.

Forefficient programming, the following should be considered.•The command needs only be loaded once when writing or reading multiple memorylocations.•Skip writing the data value 0xFF, that is the contents of the entire EEPROM (unlessthe EESAVE Fuse is programmed) and Flash after a Chip Erase.•Address High byte needs only be loaded before programming or reading a new 256word window in Flash or 256 byte EEPROM. This consideration also applies toSignature bytes reading.The Chip Erase will erase the Flash and EEPROM(1) memories plus Lock Bits.

The LockBits are not reset until the Program memory has been completely erased. The Fuse Bitsare not changed. A Chip Erase must be performed before the Flash and/or theEEPROM are reprogrammed.Note:1. The EEPRPOM memory is preserved during chip erase if the EESAVE Fuse isprogrammed.Load Command “Chip Erase”1. Set XA1, XA0 to “10”.

This enables command loading.2. Set BS1 to “0”.3. Set DATA to “1000 0000”. This is the command for Chip Erase.4. Give XTAL1 a positive pulse. This loads the command.5. Give WR a negative pulse. This starts the Chip Erase. RDY/BSY goes low.2252486O–AVR–10/046. Wait until RDY/BSY goes high before loading a new command.Programming the FlashThe Flash is organized in pages, see Table 89 on page 222. When programming theFlash, the program data is latched into a page buffer. This allows one page of programdata to be programmed simultaneously. The following procedure describes how to program the entire Flash memory:A. Load Command “Write Flash”1. Set XA1, XA0 to “10”.

This enables command loading.2. Set BS1 to ”0”.3. Set DATA to “0001 0000”. This is the command for Write Flash.4. Give XTAL1 a positive pulse. This loads the command.B. Load Address Low byte1. Set XA1, XA0 to “00”. This enables address loading.2. Set BS1 to “0”. This selects low address.3. Set DATA = Address Low byte (0x00 - 0xFF).4. Give XTAL1 a positive pulse. This loads the address Low byte.C. Load Data Low byte1.

Set XA1, XA0 to “01”. This enables data loading.2. Set DATA = Data Low byte (0x00 - 0xFF).3. Give XTAL1 a positive pulse. This loads the data byte.D. Load Data High byte1. Set BS1 to “1”. This selects high data byte.2. Set XA1, XA0 to “01”. This enables data loading.3. Set DATA = Data High byte (0x00 - 0xFF).4. Give XTAL1 a positive pulse. This loads the data byte.E. Latch Data1. Set BS1 to “1”. This selects high data byte.2. Give PAGEL a positive pulse. This latches the data bytes.

(See Figure 106 forsignal waveforms)F. Repeat B through E until the entire buffer is filled or until all data within the page isloaded.While the lower bits in the address are mapped to words within the page, the higher bitsaddress the pages within the FLASH. This is illustrated in Figure 105 on page 227. Notethat if less than eight bits are required to address words in the page (pagesize < 256),the most significant bit(s) in the address Low byte are used to address the page whenperforming a page write.G.

Load Address High byte1. Set XA1, XA0 to “00”. This enables address loading.2. Set BS1 to “1”. This selects high address.3. Set DATA = Address High byte (0x00 - 0xFF).4. Give XTAL1 a positive pulse. This loads the address High byte.H.

Program Page226ATmega8(L)2486O–AVR–10/04ATmega8(L)1. Set BS1 = “0”2. Give WR a negative pulse. This starts programming of the entire page of data.RDY/BSY goes low.3. Wait until RDY/BSY goes high. (See Figure 106 for signal waveforms)I. Repeat B through H until the entire Flash is programmed or until all data has beenprogrammed.J. End Page Programming1. Set XA1, XA0 to “10”. This enables command loading.2. Set DATA to “0000 0000”. This is the command for No Operation.3.

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

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

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

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