ATmega8 (961722), страница 13

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

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

Note that recognition of falling or rising edge interrupts on INT0 and INT1requires the presence of an I/O clock, described in “Clock Systems and their Distribution” on page 23. Low level interrupts on INT0/INT1 are detected asynchronously. Thisimplies that these interrupts can be used for waking the part also from sleep modesother than Idle mode.

The I/O clock is halted in all sleep modes except Idle mode.Note that if a level triggered interrupt is used for wake-up from Power-down mode, thechanged level must be held for some time to wake up the MCU. This makes the MCUless sensitive to noise. The changed level is sampled twice by the Watchdog Oscillatorclock. The period of the Watchdog Oscillator is 1 µs (nominal) at 5.0V and 25°C. Thefrequency of the Watchdog Oscillator is voltage dependent as shown in “Electrical Characteristics” on page 239.

The MCU will wake up if the input has the required level duringthis sampling or if it is held until the end of the start-up time. The start-up time is definedby the SUT Fuses as described in “System Clock and Clock Options” on page 23. If thelevel is sampled twice by the Watchdog Oscillator clock but disappears before the endof the start-up time, the MCU will still wake up, but no interrupt will be generated. Therequired level must be held long enough for the MCU to complete the wake up to triggerthe level interrupt.MCU Control Register –MCUCRThe MCU Control Register contains control bits for interrupt sense control and generalMCU functions.Bit76543210SESM2SM1SM0ISC11ISC10ISC01ISC00Read/WriteR/WR/WR/WR/WR/WR/WR/WR/WInitial Value00000000MCUCR• Bit 3, 2 – ISC11, ISC10: Interrupt Sense Control 1 Bit 1 and Bit 0The External Interrupt 1 is activated by the external pin INT1 if the SREG I-bit and thecorresponding interrupt mask in the GICR are set.

The level and edges on the externalINT1 pin that activate the interrupt are defined in Table 31. The value on the INT1 pin issampled before detecting edges. If edge or toggle interrupt is selected, pulses that lastlonger than one clock period will generate an interrupt. Shorter pulses are not guaranteed to generate an interrupt.

If low level interrupt is selected, the low level must be helduntil the completion of the currently executing instruction to generate an interrupt.Table 31. Interrupt 1 Sense Control64ISC11ISC10Description00The low level of INT1 generates an interrupt request.01Any logical change on INT1 generates an interrupt request.10The falling edge of INT1 generates an interrupt request.11The rising edge of INT1 generates an interrupt request.ATmega8(L)2486O–AVR–10/04ATmega8(L)• Bit 1, 0 – ISC01, ISC00: Interrupt Sense Control 0 Bit 1 and Bit 0The External Interrupt 0 is activated by the external pin INT0 if the SREG I-flag and thecorresponding interrupt mask are set. The level and edges on the external INT0 pin thatactivate the interrupt are defined in Table 32.

The value on the INT0 pin is sampledbefore detecting edges. If edge or toggle interrupt is selected, pulses that last longerthan one clock period will generate an interrupt. Shorter pulses are not guaranteed togenerate an interrupt. If low level interrupt is selected, the low level must be held untilthe completion of the currently executing instruction to generate an interrupt.Table 32. Interrupt 0 Sense ControlGeneral Interrupt ControlRegister – GICRISC01ISC0000The low level of INT0 generates an interrupt request.01Any logical change on INT0 generates an interrupt request.10The falling edge of INT0 generates an interrupt request.11The rising edge of INT0 generates an interrupt request.BitDescription76543210INT1INT0––––IVSELIVCERead/WriteR/WR/WRRRRR/WR/WInitial Value00000000GICR• Bit 7 – INT1: External Interrupt Request 1 EnableWhen the INT1 bit is set (one) and the I-bit in the Status Register (SREG) is set (one),the external pin interrupt is enabled.

The Interrupt Sense Control1 bits 1/0 (ISC11 andISC10) in the MCU general Control Register (MCUCR) define whether the externalinterrupt is activated on rising and/or falling edge of the INT1 pin or level sensed. Activityon the pin will cause an interrupt request even if INT1 is configured as an output. Thecorresponding interrupt of External Interrupt Request 1 is executed from the INT1 Interrupt Vector.• Bit 6 – INT0: External Interrupt Request 0 EnableWhen the INT0 bit is set (one) and the I-bit in the Status Register (SREG) is set (one),the external pin interrupt is enabled. The Interrupt Sense Control0 bits 1/0 (ISC01 andISC00) in the MCU general Control Register (MCUCR) define whether the externalinterrupt is activated on rising and/or falling edge of the INT0 pin or level sensed.

Activityon the pin will cause an interrupt request even if INT0 is configured as an output. Thecorresponding interrupt of External Interrupt Request 0 is executed from the INT0 Interrupt Vector.652486O–AVR–10/04General Interrupt FlagRegister – GIFRBit7654321INTF1INTF0–––––0–Read/WriteR/WR/WRRRRRRInitial Value00000000GIFR• Bit 7 – INTF1: External Interrupt Flag 1When an event on the INT1 pin triggers an interrupt request, INTF1 becomes set (one).If the I-bit in SREG and the INT1 bit in GICR are set (one), the MCU will jump to the corresponding Interrupt Vector.

The flag is cleared when the interrupt routine is executed.Alternatively, the flag can be cleared by writing a logical one to it. This flag is alwayscleared when INT1 is configured as a level interrupt.• Bit 6 – INTF0: External Interrupt Flag 0When an event on the INT0 pin triggers an interrupt request, INTF0 becomes set (one).If the I-bit in SREG and the INT0 bit in GICR are set (one), the MCU will jump to the corresponding Interrupt Vector. The flag is cleared when the interrupt routine is executed.Alternatively, the flag can be cleared by writing a logical one to it. This flag is alwayscleared when INT0 is configured as a level interrupt.66ATmega8(L)2486O–AVR–10/04ATmega8(L)8-bit Timer/Counter0Timer/Counter0 is a general purpose, single channel, 8-bit Timer/Counter module.

Themain features are:• Single Channel Counter• Frequency Generator• External Event Counter• 10-bit Clock PrescalerOverviewA simplified block diagram of the 8-bit Timer/Counter is shown in Figure 26. For theactual placement of I/O pins, refer to “Pin Configurations” on page 2. CPU accessibleI/O Registers, including I/O bits and I/O pins, are shown in bold. The device-specific I/ORegister and bit locations are listed in the “8-bit Timer/Counter Register Description” onpage 70.Figure 26.

8-bit Timer/Counter Block DiagramTCCRnDATA BUScountTOVn(Int.Req.)Control LogicClock SelectEdgeDetectorTimer/CounterTCNTnRegistersclkTnTn( From Prescaler )= 0xFFThe Timer/Counter (TCNT0) is an 8-bit register. Interrupt request (abbreviated toInt. Req. in the figure) signals are all visible in the Timer Interrupt Flag Register (TIFR).All interrupts are individually masked with the Timer Interrupt Mask Register (TIMSK).TIFR and TIMSK are not shown in the figure since these registers are shared by othertimer units.The Timer/Counter can be clocked internally or via the prescaler, or by an external clocksource on the T0 pin. The Clock Select logic block controls which clock source and edgethe Timer/Counter uses to increment its value.

The Timer/Counter is inactive when noclock source is selected. The output from the clock select logic is referred to as the timerclock (clkT0).DefinitionsMany register and bit references in this document are written in general form. A lowercase “n” replaces the Timer/Counter number, in this case 0. However, when using theregister or bit defines in a program, the precise form must be used i.e. TCNT0 foraccessing Timer/Counter0 counter value and so on.The definitions in Table 33 are also used extensively throughout this datasheet.Table 33.

DefinitionsBOTTOMThe counter reaches the BOTTOM when it becomes 0x00MAXThe counter reaches its MAXimum when it becomes 0xFF (decimal 255)672486O–AVR–10/04Timer/Counter ClockSourcesThe Timer/Counter can be clocked by an internal or an external clock source. The clocksource is selected by the clock select logic which is controlled by the clock select(CS02:0) bits located in the Timer/Counter Control Register (TCCR0). For details onclock sources and prescaler, see “Timer/Counter0 and Timer/Counter1 Prescalers” onpage 72.Counter UnitThe main part of the 8-bit Timer/Counter is the programmable counter unit.

Figure 27shows a block diagram of the counter and its surroundings.Figure 27. Counter Unit Block DiagramTOVn(Int. Req.)DATA BUSClock SelectTCNTncountControl LogicmaxclkTnEdgeDetectorTn( From Prescaler )Signal description (internal signals):countIncrement TCNT0 by 1.clkTnTimer/Counter clock, referred to as clkT0 in the following.maxSignalize that TCNT0 has reached maximum value.The counter is incremented at each timer clock (clkT0). clkT0 can be generated from anexternal or internal clock source, selected by the clock select bits (CS02:0). When noclock source is selected (CS02:0 = 0) the timer is stopped. However, the TCNT0 valuecan be accessed by the CPU, regardless of whether clkT0 is present or not.

A CPU writeoverrides (has priority over) all counter clear or count operations.Operation68The counting direction is always up (incrementing), and no counter clear is performed.The counter simply overruns when it passes its maximum 8-bit value (MAX = 0xFF) andthen restarts from the bottom (0x00).

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

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

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

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