INTERRUPT, TIMER/COUNTER. KONKUK UNIV. VLSI Design Lab. LSI Design Lab

Size: px
Start display at page:

Download "INTERRUPT, TIMER/COUNTER. KONKUK UNIV. VLSI Design Lab. LSI Design Lab"

Transcription

1 INTERRUPT, TIMER/COUNTER KONKUK UNIV. V. 1

2 INTERRUPT 의개요 외부의요구에의해서현재실행중인프로그램을일시중지하고보다시급한작업을먼저수행한후다시원래의프로그램으로복귀하는것. EX) 스타를하다가택배가오면스타를일시중지하고택배를받은후다시스타를진행함. Interrupt 방식 : 택배아저씨가초인종을눌러줌. Polling 방식 : 택배아저씨가오는지일정시간간격으로살펴봄. 2

3 INTERRUPT 의개요 An interrupt is an exception, a change of the normal progression, or interruption in the normal flow of program execution. An interrupt is essentially a hardware generated function call. Interrupts are caused by both internal and external sources. An interrupt causes the normal program execution to halt and for the interrupt service routine (ISR) to be executed. At the conclusion of the ISR, normal program execution is resumed at the point where it was last. Interrupts should be used for infrequent events (1000's of clock cycles) keyboard strokes ms clock ticks serial data (USART, SPI, TWI) Analog to digital conversion uc response time to interrupts is very fast AVR: 4 cycles max 80386: 59 cycles min, 104 cycles max; (0-wait state memory; If response time is really critical, a tight polling loop is used. polling can be faster than interrupts..., but further processing is on hold! 3

4 AVR interrupt servicing 1. In response to the interrupt, the CPU finishes any pending instructions and then ceases fetching further instructions. Global Interrupt Enable (GIE) bit is cleared. 2. Hardware pushes the program counter on the stack. 3. The CPU fetches the instruction from the interrupt vector table that corresponds to the interrupt. This instruction is usually jmp, address. The address is the address of the ISR. 4. The CPU then begins to execute the ISR code. The first part of the ISR is compiler generated code that pushes the status register on the stack as well as any registers that will be used in the ISR. 5. Just before the ISR is done, compiler generated code pops the saved registers as well as the status register. Then the RETI instruction is executed. This restores the program counter from the stack. Global Interrupt Enable bit gets set again. 6. The CPU resumes executing the original instruction stream. 4

5 INTERRUPT 의종류 Reset and Interrupt Vectors Vector NO. Program Address 5 Source 1 $0000(1) RESET Interrupt Definition External Pin, Power-on Reset, Brown-out Reset,Watchdog Reset, and JTAG AVR Reset 2 $0002 INT0 External Interrupt Request 0 3 $0004 INT1 External Interrupt Request 1 4 $0006 INT2 External Interrupt Request 2 5 $0008 INT3 External Interrupt Request 3 6 $000A INT4 External Interrupt Request 4 7 $000C INT5 External Interrupt Request 5 8 $000E INT6 External Interrupt Request 6 9 $0010 INT7 External Interrupt Request 7 10 $0012 TIMER2 COMP Timer/Counter2 Compare Match 11 $0014 TIMER2 OVF Timer/Counter2 Overflow 12 $0016 TIMER1 CAPT Timer/Counter1 Capture Event 13 $0018 TIMER1 COMPA Timer/Counter1 Compare Match A 14 $001A 15 $001C 16 $001E TIMER1 COMPB TIMER1 OVF TIMER0 COMP Timer/Counter1 Compare Match B Timer/Counter1 Overflow Timer/Counter0 Compare Match Vector Program NO. Address Source Interrupt Definition 17 $0020 TIMER0 OVF Timer/Counter0 Overflow 18 $0022 SPI, STC SPI Serial Transfer Complete 19 $0024 USART0, RX USART0, Rx Complete 20 $0026 USART0, UDRE USART0 Data Register Empty 21 $0028 USART0, TX USART0, Tx Complete 22 $002A ADC ADC Conversion Complete 23 $002C EE READY EEPROM Ready 24 $002E ANALOG COMP Analog Comparator 25 $0030 TIMER1 COMPC Timer/Countre1 Compare Match C 26 $0032 TIMER3 CAPT Timer/Counter3 Capture Event 27 $0034 TIMER3 COMPA Timer/Counter3 Compare Match A 28 $0036 TIMER3 COMPB Timer/Counter3 Compare Match B 29 $0038 TIMER3 COMPC Timer/Counter3 Compare Match C 30 $003A TIMER3 OVF Timer/Counter3 Overflow 31 $003C USART1, RX USART1, Rx Complete 32 $003E USART1, UDRE USART1 Data Register Empty 33 $0040 USART1, TX USART1, Tx Complete 34 $0042 TWI Two-wire Serial Interface 35 $0044 SPM READY Store Program Memory Ready

6 INTERRUPT 의종류 Reset and Interrupt Vectors Placement BOOTRST IVSEL Reset Address Interrupt Vectors Start Address 1 0 $0000 $ $0000 Boot Reset Address + $ Boot Reset Address $ Boot Reset Address Boot Reset Address + $0002 AVR interrupt vector table All interrupts have separate interrupt vectors in the interrupt vector table Interrupts have priority in accordance with their position in the table. Lower interrupt vector address have higher priority. Reset has top priority. 6

7 INTERRUPT PORT 의연결 INT0~INT7 7

8 Interrupt Vector Select: MCU Control Register MCUCR Bit 1 IVSEL: Interrupt Vector Select When the IVSEL bit is cleared (zero), the interrupt vectors are placed at the start of the Flash memory. When this bit is set (one), the interrupt vectors are moved to the beginning of the Boot Loader section of the flash. The actual address of the start of the Boot Flash section is determined by the BOOTSZ fuses. Refer to the section Boot Loader Support Read-While-Write Self-Programming on page 276 for details. To avoid unintentional changes of interrupt vector tables, a special write procedure must be followed to change the IVSEL bit: 1. Write the Interrupt Vector Change Enable (IVCE) bit to one. 2. Within four cycles, write the desired value to IVSEL while writing a zero to IVCE. Interrupts will automatically be disabled while this sequence is executed. Interrupts are disabled in the cycle IVCE is set, and they remain disabled until after the instruction following the write to IVSEL. If IVSEL is not written, interrupts remain disabled for four cycles. The I-bit in the Status Register is unaffected by the automatic disabling. Note: If interrupt vectors are placed in the Boot Loader section and Boot Lock bit BLB02 is programmed, interrupts are disabled while executing from the Application section. If interrupt vectors are placed in the Application section and Boot Lock bit BLB12 is programed, interrupts are disabled while executing from the Boot Loader section. Refer to the section Boot Loader Support Read-While-Write Self-Programming on page 276 for details on Boot Lock bits. Bit 0 IVCE: Interrupt Vector Change Enable The IVCE bit must be written to logic one to enable change of the IVSEL bit. IVCE is cleared by hardware four cycles after it is written or when IVSEL is written. Setting the IVCE bit will disable interrupts, as explained in the IVSEL. 8

9 External Interrupts The External Interrupts are triggered by the INT7:0 pins. If enabled, the interrupts will trigger even if the INT7:0 pins are configured as outputs. This feature provides a way of generating a software interrupt. The External Interrupts can be triggered by a falling or rising edge or a low level. This is set up as indicated in the specification for the External Interrupt Control Registers EICRA (INT3:0) and EICRB (INT7:4). When the external interrupt is enabled and is configured as level triggered, the interrupt will trigger as long as the pin is held low. Note that recognition of falling or rising edge interrupts on INT7:4 requires the presence of an I/O clock, described in Clock Systems and their Distribution on page 36. Low level interrupts and the edge interrupt on INT3:0 are detected asynchronously. This implies that these interrupts can be used for waking the part also from sleep modes other than Idle mode. 9

10 External Interrupts Low level interrupts and the edge interrupt on INT3:0 are detected asynchronously. This implies that these interrupts can be used for waking the part also from sleep modes other 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, the changed level must be held for some time to wake up the MCU. This makes the MCU less sensitive to noise. The changed level is sampled twice by the Watchdog Oscillator clock. The period of the Watchdog Oscillator is 1 µs (nominal) at 5.0V and 25 C. The frequency of the Watchdog Oscillator is voltage dependent as shown in the Electrical Characteristics on page 322. The MCU will wake up if the input has the required level during this sampling or if it is held until the end of the start-up time. The start-up time is defined by the SUT fuses as described in Clock Systems and their Distribution on page 36. If the level is sampled twice by the Watchdog Oscillator clock but disappears before the end of the start-up time, the MCU will still wake up, but no interrupt will be generated. The required level must be held long enough for the MCU to complete the wake up to trigger the level interrupt. 10

11 Interrupts registers External Interrupt Control Register A EICRA External Interrupt Control Register B EICRB External Interrupt Mask Register EIMSK External Interrupt Flag Register EIFR 11

12 INTERRUPT REGISTER - EICRA External Interrupt Control Register A EICRA 모든인터럽트는 GLOBAL INTERRUPT가 ENABLE 되어야작동함. 외부인터럽트제어레지스터 A : EICRA (INT0~INT3) This Register can not be reached in ATmega103 compatibility mode, but the initial value defines INT3:0 as low level interrupts, as in ATmega103. Bits 7..0 ISC31, ISC30 ISC00, ISC00: External Interrupt 3-0 Sense Control Bits The External Interrupts 3-0 are activated by the external pins INT3:0 if the SREG I-flag and the corresponding interrupt mask in the EIMSK is set. Edges on INT3..INT0 are registered asynchronously. Pulses on INT3:0 pins wider than the minimum pulse width given in Table 49 will generate an interrupt. Shorter pulses are not guaranteed to generate an interrupt. If low level interrupt is selected, the low level must be held until the completion of the currently executing instruction to generate an interrupt. If enabled, a level triggered interrupt will generate an interrupt request as long as the pin is held low. When changing the ISCn bit, an interrupt can occur. Therefore, it is recommended to first disable INTn by clearing its Interrupt Enable bit in the EIMSK Register. Then, the ISCn bit can be changed. Finally, the INTn interrupt flag should be cleared by writing a logical one to its Interrupt Flag bit (INTFn) in the EIFR Register before the interrupt is reenabled. 12

13 INTERRUPT REGISTER - EICRA Interrupt Sense Control (1) ISCn1 ISCn0 Description 0 0 The low level of INTn generates an interrupt request. 0 1 Reserved 1 0 The falling edge of INTn generates asynchronously an interrupt request. 1 1 The rising edge of INTn generates asynchronously an interrupt request. Note: 1. n = 3, 2, 1or 0. When changing the ISCn1/ISCn0 bits, the interrupt must be disabled by clearing its Interrupt Enable bit in the EIMSK Register. Otherwise an interrupt can occur when the bits are changed. Asynchronous External Interrupt Characteristics 13

14 INTERRUPT REGISTER - EICRB 외부인터럽트제어레지스터 B : EICRB (INT4~INT7) Bits 7..0 ISC71, ISC70 - ISC41, ISC40: External Interrupt 7-4 Sense Control Bits The External Interrupts 7-4 are activated by the external pins INT7:4 if the SREG I-flag and the corresponding interrupt mask in the EIMSK is set. The level and edges on the external pins that activate the interrupts are defined in Table 50. The value on the INT7:4 pins are sampled before detecting edges. If edge or toggle interrupt is selected, pulses that last longer than one clock period will generate an interrupt. Shorter pulses are not guaranteed to generate an interrupt. Observe that CPU clock frequency can be lower than the XTAL frequency if the XTAL divider is enabled. If low level interrupt is selected, the low level must be held until the completion of the currently executing instruction to generate an interrupt. If enabled, a level triggered interrupt will generate an interrupt request as long as the pin is held low. 14

15 INTERRUPT REGISTER - EICRB Interrupt Sense Control (1) ISCn1 ISCn0 Description 0 0 The low level of INTn generates an interrupt request. 0 1 Any logical change on INTn generates an interrupt request 1 0 The falling edge between two samples of INTn generates an interrupt request. 1 1 The rising edge between two samples of INTn generates an interrupt request. n = 7, 6, 5 or 4. When changing the ISCn1/ISCn0 bits, the interrupt must be disabled by clearing its Interrupt Enable bit in the EIMSK Register. Otherwise an interrupt can occur when the bits are changed. 15

16 INTERRUPT REGISTER - EIMSK External Interrupt Mask Register EIMSK 외부인터럽트마스크레지스터 : EIMSK 어떤입력을인터럽트로사용할지를설정. Bits 7..0 INT7 INT0: External Interrupt Request 7-0 Enable When an INT7 INT0 bit is written to one and the I-bit in the Status Register (SREG) is set (one), the corresponding external pin interrupt is enabled. The Interrupt Sense Control bits in the External Interrupt Control Registers EICRA and EICRB defines whether the external interrupt is activated on rising or falling edge or level sensed. Activity on any of these pins will trigger an interrupt request even if the pin is enabled as an output. This provides a way of generating a software interrupt. 16

17 INTERRUPT REGISTER - EIFR External Interrupt Flag Register EIFR 외부인터럽트플래그레지스터 : EIFR INT0~INT7 중에해당인터럽트가트리거되었음을표시하는데사용. 해당인터럽트서비스루틴으로점프하게되면 0 으로설정됨. Bits 7..0 INTF7 - INTF0: External Interrupt Flags 7 0 When an edge or logic change on the INT7:0 pin triggers an interrupt request, INTF7:0 becomes set (one). If the I-bit in SREG and the corresponding interrupt enable bit, INT7:0 in EIMSK, are set (one), the MCU will jump to the 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. These flags are always cleared when INT7:0 are configured as level interrupt. Note that when entering sleep mode with the INT3:0 interrupts disabled, the input buffers on these pins will be disabled. This may cause a logic change in internal signals which will set the INTF3:0 flags. 17

18 INTERRUPT EXAMPLE INT4 버튼이눌러질때마다 LED 가 on, off 를반복하는프로그램. Interrupt 4 LED1 LED2 LED3 LED4 18 LED1 LED2 LED3 LED4

19 2. TIMER/ COUNTER 19

20 TIMER/COUNTER 의개요 입력으로들어오는신호 ( 펄스 ) 를세는장치이며입력신호의소스가내부클럭에의존하면타이머이고, 외부핀으로들어오는신호에의존하면카운터가된다. ATmega128 은 4 개의 TIMER/COUNTER 로구성된다. Timer/Counter0(8 비트 ), Timer/Counter1(16 비트 ), Timer/Counter2(8 비트 ), Timer/Counter3(16 비트 ) OVERFLOW INTERRUPT 카운터값이오버플로우된경우발생. 20

21 TIMER/COUNTER 의개요 Timer/Counter0 내부클럭혹은외부클럭을모두사용가능. 외부클럭을사용할경우비동기모드로동작가능. 프리스케일러적용가능. ** 프리스케일러 : 타이머에입력되는클럭의속도를조절할수있는분주기. Timer/Counter1~3 내부클럭사용. 프리스케일러적용가능. 21

22 Block Diagram of 8bit TIMER/COUNTER 22

23 Block Diagram of Output Compare Unit/OCxy Pins 23

24 TIMER/COUNTER REGISTER Timer/Counter Control Register TCCR0 Timer/Counter Register TCNT0 Output Compare Register OCR0 Asynchronous Status Register ASSR Timer/Counter Interrupt Mask Register TIMSK Timer/Counter Interrupt Flag Register TIFR 24

25 TIMER/COUNTER REGISTER TCCR0 TIMER/COUNTER 제어레지스터 : TCCR0 Bit 7 FOC0: Force Output Compare FOC0 : 1 로설정할경우즉시강제로 OC0 단자에비교매치 (compare match) 신호를출력. OSR0 에어떤값을써준후 Timer/Counter0 가 OSR0 의값과같아질때 OC0 단자 (PB4) 를 toggle, set, clear 시킬수있다. The FOC0 bit is only active when the WGM bits specify a non-pwm mode. For ensuring compatibility with future devices, this bit must be set to zero when TCCR0 is written when operating in PWM mode. When writing a logical one to the FOC0 bit, an immediate compare match is forced on the waveform generation unit. The OC0 output is changed according to its COM01:0 bits setting. Note that the FOC0 bit is implemented as a strobe. Therefore it is the value present in the COM01:0 bits that determines the effect of the forced compare. A FOC0 strobe will not generate any interrupt, nor will it clear the timer in CTC mode using OCR0 as TOP. The FOC0 bit is always read as zero. 25

26 TIMER/COUNTER REGISTER TCCR0 TIMER/COUNTER 제어레지스터 : TCCR0 Bit 6, 3 WGM01:0: Waveform Generation Mode These bits control the counting sequence of the counter, the source for the maximum (TOP) counter value, and what type of waveform generation to be used. Modes of operation supported by the Timer/Counter unit are: Normal mode, Clear Timer on Compare match (CTC) mode, and two types of Pulse Width Modulation (PWM) modes. 26

27 TIMER/COUNTER REGISTER TCCR0 cont. WGM00~01 Waveform Generation Mode 어떤파형을발생시킬지를결정 Normal Mode : 255 까지카운터한뒤인터럽트발생. CTC (Clear Timer on Compare match) : 인터럽트를발생시키는최대카운터수를설정. Fast PWM Mode : 최대카운터수이전에인터럽트발생설정. PCPWM (Phase Correct Pulse Width Modulation) : 최대카운터수로부터 0 까지역순으로카운트. 27

28 TIMER/COUNTER REGISTER TCCR0 cont. Bit 5:4 COM01:0: Compare Match Output Mode: COM00~01 Compare Match Output Mode OC0 단자에비교매치를출력. These bits control the output compare pin (OC0) behavior. If one or both of the COM01:0 bits are set, the OC0 output overrides the normal port functionality of the I/O pin it is connected to. However, note that the Data Direction Register (DDR) bit corresponding to OC0 pin must be set in order to enable the output driver. When OC0 is connected to the pin, the function of the COM01:0 bits depends on the WGM01:0 bit setting. Table 53 shows the COM01:0 bit functionality when the WGM01:0 bits are set to a normal or CTC mode (non- PWM). Table 54 shows the COM01:0 bit functionality when the WGM01:0 bits are set to fast PWM mode. Table 55 shows the COM01:0 bit functionality when the WGM01:0 bits are set to phase correct PWM mode. 28

29 TIMER/COUNTER REGISTER TCCR0 cont. Bit 2:0 CS02:0: Clock Select: CS02~CS00 : PRESCALER의설정 The three clock select bits select the clock source to be used by the Timer/Counter. Clock Select Bit Description 29

30 TIMER/COUNTER REGISTER TCNT0 TIMER/COUNTER 제어레지스터 : TCNT0 8bit 카운터값을저장. The Timer/Counter Register gives direct access, both for read and write operations, to the Timer/Counter unit 8-bit counter. Writing to the TCNT0 Register blocks (removes) the compare match on the following timer clock. Modifying the counter (TCNT0) while the counter is running, introduces a risk of missing a compare match between TCNT0 and the OCR0 Register. TIMER/COUNTER 제어레지스터 : OCR0 TCNT0 값과비교하여 OC0 단자에출력신호를발생하기위한 8bit 값을저장. 30

31 TIMER/COUNTER REGISTER OCR0 TIMER/COUNTER 제어레지스터 : OCR0 TCNT0 값과비교하여 OC0 단자에출력신호를발생하기위한 8bit 값을저장. The Output Compare Register contains an 8-bit value that is continuously compared with the counter value (TCNT0). A match can be used to generate an output compare interrupt, or to generate a waveform output on the OC0 pin. 31

32 TIMER/COUNTER REGISTER - ASSR TIMER/COUNTER 제어레지스터 : ASSR 외부클럭에의하여비동기모드로동작하는경우관련기능을수행. Bit 3 AS0: Asynchronous Timer/Counter0 When AS0 is written to zero, Timer/Counter0 is clocked from the I/O clock, clki/o. When AS0 is written to one, Timer/Counter is clocked from a crystal Oscillator connected to the Timer Oscillator 1 (TOSC1) pin. When the value of AS0 is changed, the contents of TCNT0, OCR0, and TCCR0 might be corrupted. Bit 2 TCN0UB: Timer/Counter0 Update Busy When Timer/Counter0 operates asynchronously and TCNT0 is written, this bit becomes set. When TCNT0 has been updated from the temporary storage register, this bit is cleared by hardware. A logical zero in this bit indicates that TCNT0 is ready to be updated with a new value. 32

33 TIMER/COUNTER REGISTER - ASSR TIMER/COUNTER 제어레지스터 : ASSR Bit 1 OCR0UB: Output Compare Register0 Update Busy When Timer/Counter0 operates asynchronously and OCR0 is written, this bit becomes set. When OCR0 has been updated from the temporary storage register, this bit is cleared by hardware. A logical zero in this bit indicates that OCR0 is ready to be updated with a new value. Bit 0 TCR0UB: Timer/Counter Control Register0 Update Busy When Timer/Counter0 operates asynchronously and TCCR0 is written, this bit becomes set. When TCCR0 has been updated from the temporary storage register, this bit is cleared by hardware. A logical zero in this bit indicates that TCCR0 is ready to be updated with a new value. If a write is performed to any of the three Timer/Counter0 Registers while its update busy flag is set, the updated value might get corrupted and cause an unintentional interrupt to occur. The mechanisms for reading TCNT0, OCR0, and TCCR0 are different. When reading TCNT0, the actual timer value is read. When reading OCR0 or TCCR0, the value in the temporary storage register is read. 33

34 TIMER/COUNTER REGISTER - TIMSK TIMER/COUNTER 제어레지스터 : TIMSK Bit 1 OCIE0: Timer/Counter0 Output Compare Match Interrupt Enable 1 로설정되고, 상태레지스터 (SREG) 의 I-bit 이 1 로설정될경우작동. 이렇게설정된상태에서 TIFR 의 OCF0 가 1 이되면이인터럽트가처리됨. Bit 0 TOIE0: Timer/Counter0 Overflow Interrupt Enable TOIE0 : 1 로설정되고, SREG 의 I-bit 이 1 이로설정되면 Overflow interrupt 가 enable 됨. 34

35 TIMER/COUNTER REGISTER - TIFR TIMER/COUNTER 인터럽트플래그레지스터 : TIFR Bit 1 OCF0: Output Compare Flag 0 OCF0 : Timer/Counter0 와 OCR0 의데이터사이에비교매치가발생한경우 1 로설정된다. 인터럽트가처리된후 clear 된다. Bit 0 TOV0: Timer/Counter0 Overflow Flag TOV0 : Overflow 가발생한경우 1 로설정된다. 인터럽트가처리된후 clear 된다. 35

36 Prescaler of Timer/Counter0 The clock source for Timer/Counter0 is named clkt0. clkt0 is by default connected to the main system clock clki/o. By setting the AS0 bit in ASSR, Timer/Counter0 is asynchronously clocked from the TOSC1 pin. This enables use of Timer/Counter0 as a Real Time Counter (RTC). When AS0 is set, pins TOSC1 and TOSC2 are disconnected from Port C. A crystal can then be connected between the TOSC1 and TOSC2 pins to serve as an independent clock source for Timer/Counter0. The Oscillator is optimized for use with a khz crystal. Applying an external clock source to TOSC1 is not recommended. For Timer/Counter0, the possible prescaled selections are: clkt0s/8, clkt0s/32, clkt0s/64, clkt0s/128, clkt0s/256, and clkt0s/1024. Additionally, clkt0s as well as 0 (stop) may be selected. Setting the PSR0 bit in SFIOR resets the prescaler. This allows the user to operate with a predictable prescaler

37 16-bit Timer/Counter (Timer/Counter1 and Timer/Counter3) The 16-bit Timer/Counter unit allows accurate program execution timing (event management), wave generation, and signal timing measurement. The main features are: True 16-bit Design (i.e.,allows 16-bit PWM) Three Independent Output Compare Units Double Buffered Output Compare Registers One Input Capture Unit Input Capture Noise Canceler Clear Timer on Compare Match (Auto Reload) Glitch-free, Phase Correct Pulse width Modulator (PWM) Variable PWM Period Frequency Generator External Event Counter Ten Independent Interrupt Sources (TOV1, OCF1A, OCF1B, OCF1C, ICF1, TOV3, OCF3A, OCF3B, OCF3C, and ICF3) 37

38 Training board - External Interrupt Switches Hardware Interrupt using External Switches. In the training board, there are 2 switches which are connected to INT4 and INT5 of AVR

39 TIMER EXAMPLE 39

40 HW#1 INTERRUPT (UP AND DOWN) INT4 SW 를누르면 up 카운트가되고 INT5 SW 를누르면 down 카운트가되게만든다. 40

41 HW#2 INTERRUPT (start&stop, up&down) INT4 스위치를누르면 0000 셋팅에서일자리부터증가 START(1->2->3->4 ), 다시누르면증가 STOP. INT5 스위치를누르면 UP 카운팅, 다시누르면 DOWN 카운팅되도록한다. 41

42 HW#3 INTERRUPT (Stop Watch) 7-Segment 와 Timer Interrupt 를사용하여정확한 Stop Watch 를구현할것. INT4를누를경우 START 동작중에 INT4를누를경우 STOP 동작중에 INT5를누를경우 RESET( 계속동작 ) 정지상태에서 INT4를누를경우 START 정지상태에서 INT5를누를경우 RESET 42

COMP2121: Microprocessors and Interfacing

COMP2121: Microprocessors and Interfacing Lecture 19: Interrupts II http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 1, 2006 Overview AVR Interrupts Interrupt Vector Table System Reset Watchdog Timer Timer/Counter0 Interrupt Service

More information

ATmega Interrupts. Reading. The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi

ATmega Interrupts. Reading. The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi 1 P a g e ATmega Interrupts Reading The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 10: AVR Interrupt Programming in Assembly

More information

Atmel AVR Timers and Interrupts

Atmel AVR Timers and Interrupts 1 P a g e Atmel AVR Timers and Interrupts Reading The AVR Microcontroller and Embedded Systems using Assembly and C) by Muhammad Ali Mazidi, Sarmad Naimi, and Sepehr Naimi Chapter 10: AVR Interrupt Programming

More information

Topic 11: Interrupts ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR

Topic 11: Interrupts ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Topic 11: Interrupts ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Objectives To become familiar with interrupts on the AVR Maskable and non-maskable Initialization Triggers To develop interrupt service routines

More information

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2313

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2313 Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32x8GeneralPurposeWorkingRegisters Up to 10

More information

EE 308: Microcontrollers

EE 308: Microcontrollers EE 308: Microcontrollers Interrupts Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA March 1, 2018 Aly El-Osery (NMT) EE 308: Microcontrollers

More information

Timers and Interrupts. Mark Neil - Microprocessor Course

Timers and Interrupts. Mark Neil - Microprocessor Course Timers and Interrupts 1 Example Product: Signal Generator A Signal Generator should be programmable. A user can use the the LCD display and the keyboard to change the: Frequency scale Amplitude scale Offset

More information

Embedded Systems and Software

Embedded Systems and Software Embedded Systems and Software Lecture 11 Interrupts Interrupts Slide 1 Interrupts One way to think of interrupts is that they are hardwaregenerated functions calls Internal Hardware When timer rolls over,

More information

8-bit Microcontroller with 8K Bytes Programmable Flash AT90C8534. Preliminary

8-bit Microcontroller with 8K Bytes Programmable Flash AT90C8534. Preliminary Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up

More information

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash. ATtiny22 ATtiny22L. Preliminary. Features. Description

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash. ATtiny22 ATtiny22L. Preliminary. Features. Description Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 118 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers

More information

Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo

Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo Interrupts (II) Lecturer: Sri Parameswaran Notes by: Annie Guo 1 External Interrupts The external interrupts are triggered by the INT7:0 pins. If enabled, the interrupts will trigger even if the INT7:0

More information

Microprocessors & Interfacing

Microprocessors & Interfacing Lecture Overview Microprocessors & Interfacing Interrupts (II) Interrupts in AVR External interrupts Internal interrupts Timers/Counters Lecturer : Dr. Annie Guo S2, 2008 COMP9032 Week7 1 S2, 2008 COMP9032

More information

AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Features. Introduction. AVR 8-bit Microcontrollers APPLICATION NOTE

AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Features. Introduction. AVR 8-bit Microcontrollers APPLICATION NOTE AVR 8-bit Microcontrollers AVR134: Real Time Clock (RTC) Using the Asynchronous Timer APPLICATION NOTE Features Real Time Clock with Very Low Power Consumption (10µA @ 3.3V) Very Low Cost Solution Adjustable

More information

8-bit Microcontroller with 1K Byte of In-System Programmable Flash AT90S1200

8-bit Microcontroller with 1K Byte of In-System Programmable Flash AT90S1200 Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 89 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up to

More information

8-bit Microcontroller with 1K Byte Flash. ATtiny15L

8-bit Microcontroller with 1K Byte Flash. ATtiny15L Features High-performance, Low-power AVR 8-bit Microcontroller Advanced RISC Architecture 90 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static

More information

Fundamental concept in computation Interrupt execution of a program to handle an event

Fundamental concept in computation Interrupt execution of a program to handle an event Interrupts Fundamental concept in computation Interrupt execution of a program to handle an event Don t have to rely on program relinquishing control Can code program without worrying about others Issues

More information

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2323 AT90LS2323 AT90S2343 AT90S/LS2323. Features.

8-bit Microcontroller with 2K Bytes of In-System Programmable Flash AT90S2323 AT90LS2323 AT90S2343 AT90S/LS2323. Features. Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 118 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers

More information

Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR

Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Topic 11: Timer ISMAIL ARIFFIN FKE UTM SKUDAI JOHOR Introduction Timer s objective Timer features Timer Registers - Understand function of each bit Initialization Introduction o In micro-p, we use counter

More information

AGH University of Science and Technology Cracow Department of Electronics

AGH University of Science and Technology Cracow Department of Electronics AGH University of Science and Technology Cracow Department of Electronics Microprocessors laboratory Tutorial 7 Interrupts Author: Paweł Russek http://www.fpga.agh.edu.pl/upt ver. 01/07/14 1/12 1. Introduction

More information

8-bit Microcontroller with 4K/8K bytes In-System Programmable Flash AT90S4414 AT90S8515. Features. Pin Configurations

8-bit Microcontroller with 4K/8K bytes In-System Programmable Flash AT90S4414 AT90S8515. Features. Pin Configurations Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 118 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers

More information

8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT90S8515

8-bit Microcontroller with 8K Bytes In-System Programmable Flash AT90S8515 Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up

More information

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer Features Real-Time Clock with Very Low Power Consumption (4µA @ 3.3V) Very Low Cost Solution Adjustable Prescaler to Adjust Precision Counts Time,

More information

School of Electrical, Computer and Telecommunications Engineering University of Wollongong Australia

School of Electrical, Computer and Telecommunications Engineering University of Wollongong Australia ECTE333 s schedule ECTE333 Lecture 9 -Timers School of Electrical, Computer and Telecommunications Engineering University of Wollongong Australia Week Lecture (2h) Tutorial (h) Lab (2h) L7: C programming

More information

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction.

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction. AVR XMEGA TM Product Introduction 32-bit AVR UC3 AVR Flash Microcontrollers The highest performance AVR in the world 8/16-bit AVR XMEGA Peripheral Performance 8-bit megaavr The world s most successful

More information

8-bit Microcontroller with 1K Bytes Flash. ATtiny10 ATtiny11 ATtiny12. Preliminary. Features. Pin Configuration

8-bit Microcontroller with 1K Bytes Flash. ATtiny10 ATtiny11 ATtiny12. Preliminary. Features. Pin Configuration Features Utilizes the AVR RISC Architecture High-performance and Low-power 8-bit RISC Architecture 90 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers

More information

Clock and Fuses. Prof. Prabhat Ranjan Dhirubhai Ambani Institute of Information and Communication Technology, Gandhinagar

Clock and Fuses. Prof. Prabhat Ranjan Dhirubhai Ambani Institute of Information and Communication Technology, Gandhinagar Clock and Fuses Prof. Prabhat Ranjan Dhirubhai Ambani Institute of Information and Communication Technology, Gandhinagar Reference WHY YOU NEED A CLOCK SOURCE - COLIN O FLYNN avrfreaks.net http://en.wikibooks.org/wiki/atmel_avr

More information

Introduction to Embedded Systems

Introduction to Embedded Systems Stefan Kowalewski, 4. November 25 Introduction to Embedded Systems Part 2: Microcontrollers. Basics 2. Structure/elements 3. Digital I/O 4. Interrupts 5. Timers/Counters Introduction to Embedded Systems

More information

8-bit Microcontroller with 4K Bytes of In-System Programmable Flash AT90S4433 AT90LS4433. Features. Not Recommend for New Designs. Use ATmega8.

8-bit Microcontroller with 4K Bytes of In-System Programmable Flash AT90S4433 AT90LS4433. Features. Not Recommend for New Designs. Use ATmega8. Features High-performance and Low-power AVR 8-bit RISC Architecture 118 Powerful Instructions Most Single Cycle Execution 32 x 8 General Purpose Working Registers Up to 8 MIPS Throughput at 8 MHz Data

More information

Physics 120B: Lecture 11. Timers and Scheduled Interrupts

Physics 120B: Lecture 11. Timers and Scheduled Interrupts Physics 120B: Lecture 11 Timers and Scheduled Interrupts Timer Basics The ATMega 328 has three @mers available to it (Arduino Mega has 6) max frequency of each is 16 MHz, on Arduino TIMER0 is an 8- bit

More information

Processor and compiler dependent

Processor and compiler dependent Fundamental concept in computation Interrupt execution of a program to handle an event Don t have to rely on program relinquishing control Can code program without worrying about others Issues What can

More information

AVR XMEGA TM. A New Reference for 8/16-bit Microcontrollers. Ingar Fredriksen AVR Product Marketing Director

AVR XMEGA TM. A New Reference for 8/16-bit Microcontrollers. Ingar Fredriksen AVR Product Marketing Director AVR XMEGA TM A New Reference for 8/16-bit Microcontrollers Ingar Fredriksen AVR Product Marketing Director Kristian Saether AVR Product Marketing Manager Atmel AVR Success Through Innovation First Flash

More information

Arduino Uno R3 INTRODUCTION

Arduino Uno R3 INTRODUCTION Arduino Uno R3 INTRODUCTION Arduino is used for building different types of electronic circuits easily using of both a physical programmable circuit board usually microcontroller and piece of code running

More information

MICROPROCESSOR BASED SYSTEM DESIGN

MICROPROCESSOR BASED SYSTEM DESIGN MICROPROCESSOR BASED SYSTEM DESIGN Lecture 5 Xmega 128 B1: Architecture MUHAMMAD AMIR YOUSAF VON NEUMAN ARCHITECTURE CPU Memory Execution unit ALU Registers Both data and instructions at the same system

More information

8. Power Management and Sleep Modes

8. Power Management and Sleep Modes 8. Power Management and Sleep Modes 8.1 Features Power management for adjusting power consumption and functions Five sleep modes Idle Power down Power save Standby Extended standby Power reduction register

More information

INTERRUPTS in microprocessor systems

INTERRUPTS in microprocessor systems INTERRUPTS in microprocessor systems Microcontroller Power Supply clock fx (Central Proccesor Unit) CPU Reset Hardware Interrupts system IRQ Internal address bus Internal data bus Internal control bus

More information

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega163 ATmega163L. Advance Information

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega163 ATmega163L. Advance Information Features High-performance, Low-power AVR 8-bit Microcontroller 3 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation Up to 8 MIPS Throughput

More information

8-bit Microcontroller with 1K Byte Flash. ATtiny11. ATtiny12

8-bit Microcontroller with 1K Byte Flash. ATtiny11. ATtiny12 Features Utilizes the AVR RISC Architecture High-performance and Low-power 8-bit RISC Architecture 90 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Up

More information

Microprocessors & Interfacing

Microprocessors & Interfacing Lecture Overview Microprocessors & Interfacing Interrupts (I) Lecturer : Dr. Annie Guo Introduction to Interrupts Interrupt system specifications Multiple sources of interrupts Interrupt priorities Interrupts

More information

AVR Timers TIMER0. Based on:

AVR Timers TIMER0. Based on: AVR Timers TIMER0 Based on: http://maxembedded.wordpress.com/2011/06/24/avr-timers-timer0-2/ The basic concepts of AVR Timers. Let me summarize it: We have seen how timers are made up of registers, whose

More information

AGH University of Science and Technology Cracow Department of Electronics

AGH University of Science and Technology Cracow Department of Electronics AGH University of Science and Technology Cracow Department of Electronics Microprocessors laboratory Tutorial 7 Interrupts Author: Paweł Russek http://www.fpga.agh.edu.pl/upt ver. 25/05/16 1/11 1. Introduction

More information

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega163 ATmega163L

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega163 ATmega163L Features High-performance, Low-power AVR 8-bit Microcontroller 3 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation Up to 8 MIPS Throughput

More information

8-bit Microcontroller with 128K Bytes In-System Programmable Flash. ATmega103 ATmega103L

8-bit Microcontroller with 128K Bytes In-System Programmable Flash. ATmega103 ATmega103L Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 121 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers + Peripheral

More information

Physics 124: Lecture 12. Timer Basics. Timers and Scheduled Interrupts

Physics 124: Lecture 12. Timer Basics. Timers and Scheduled Interrupts Physics 124: Lecture 12 Timers and Scheduled Interrupts Timer Basics The Arduino Uno/Nano (ATMega 328) has three Hmers available to it (Arduino Mega has 6) max frequency of each is 16 MHz, (as assembled)

More information

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1 Interrupts (I) Lecturer: Sri Notes by Annie Guo Week8 1 Lecture overview Introduction to Interrupts Interrupt system specifications Multiple Sources of Interrupts Interrupt Priorities Interrupts in AVR

More information

8-bit Microcontroller with 2K Bytes of Flash. ATtiny28L ATtiny28V

8-bit Microcontroller with 2K Bytes of Flash. ATtiny28L ATtiny28V Features Utilizes the AVR RISC Architecture AVR High-performance and Low-power RISC Architecture 90 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General-purpose Working Registers Up to

More information

Lecture 14. Ali Karimpour Associate Professor Ferdowsi University of Mashhad

Lecture 14. Ali Karimpour Associate Professor Ferdowsi University of Mashhad Lecture 14 AUTOMATIC CONTROL SYSTEMS Ali Karimpour Associate Professor Ferdowsi University of Mashhad Lecture 4 The AVR Microcontroller Introduction to AVR CISC (Complex Instruction Set Computer) Put as

More information

AVR094: Replacing ATmega8 by ATmega88. 8-bit Microcontrollers. Application Note. Features. Introduction

AVR094: Replacing ATmega8 by ATmega88. 8-bit Microcontrollers. Application Note. Features. Introduction AVR094: Replacing by 8 Features Interrupt Vectors Bit and Register s and locations Oscillators and Start up Delay Brown Out Detection USART Control Register access Internal Voltage Reference Programming

More information

FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100)

FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100) (Revision-10) FIFTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLOGY-MARCH 2014 EMBEDDED SYSTEMS (Common for CT,CM) [Time: 3 hours] (Maximum marks : 100) PART-A (Maximum marks : 10) I. Answer all

More information

8-bit Microcontroller with 64K/128K Bytes In-System Programmable Flash. ATmega603 ATmega603L ATmega103 ATmega103L. Preliminary.

8-bit Microcontroller with 64K/128K Bytes In-System Programmable Flash. ATmega603 ATmega603L ATmega103 ATmega103L. Preliminary. Features Utilizes the AVR RISC Architecture AVR - High-performance and Low-power RISC Architecture 120/121 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers

More information

Interrupts and timers

Interrupts and timers Applied mechatronics, Lab project Interrupts and timers Sven Gestegård Robertz Department of Computer Science, Lund University 2018 Outline 1 Interrupts Interrupt types Execution of an interrupt Maskable

More information

Chapter 2. Overview of Architecture and Microcontroller-Resources

Chapter 2. Overview of Architecture and Microcontroller-Resources Chapter 2 Overview of Architecture and Microcontroller-Resources Lesson 4 Timers, Real Time Clock Interrupts and Watchdog Timer 2 Microcontroller-resources Port P1 Port P0 Port P2 PWM Timers Internal Program

More information

ARDUINO MEGA INTRODUCTION

ARDUINO MEGA INTRODUCTION ARDUINO MEGA INTRODUCTION The Arduino MEGA 2560 is designed for projects that require more I/O llines, more sketch memory and more RAM. With 54 digital I/O pins, 16 analog inputs so it is suitable for

More information

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1 M68HC08 Microcontroller The MC68HC908GP32 Babak Kia Adjunct Professor Boston University College of Engineering Email: bkia -at- bu.edu ENG SC757 - Advanced Microprocessor Design General Description The

More information

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation.

8-bit Microcontroller. Application Note. AVR134: Real-Time Clock (RTC) using the Asynchronous Timer. Features. Theory of Operation. : Real-Time Clock (RTC) using the Asynchronous Timer Features Real-Time Clock with Very Low Power Consumption (4µA @ 3.3V) Very Low Cost Solution Adjustable Prescaler to Adjust Precision Counts Time, Date,

More information

VLSI Design Lab., Konkuk Univ. Yong Beom Cho LSI Design Lab

VLSI Design Lab., Konkuk Univ. Yong Beom Cho LSI Design Lab AVR Training Board-I V., Konkuk Univ. Yong Beom Cho ybcho@konkuk.ac.kr What is microcontroller A microcontroller is a small, low-cost computeron-a-chip which usually includes: An 8 or 16 bit microprocessor

More information

VCC PB2 (SCK/ADC1/T0/PCINT2) PB1 (MISO/AIN1/OC0B/INT0/PCINT1) PB0 (MOSI/AIN0/OC0A/PCINT0)

VCC PB2 (SCK/ADC1/T0/PCINT2) PB1 (MISO/AIN1/OC0B/INT0/PCINT1) PB0 (MOSI/AIN0/OC0A/PCINT0) Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 120 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static

More information

TIMSK=0b ; /* enables the T/C0 overflow interrupt in the T/C interrupt mask register for */

TIMSK=0b ; /* enables the T/C0 overflow interrupt in the T/C interrupt mask register for */ The codes below which help in better understanding of timers and counters. I have tested this code for atmega32. I have taken reference from www.avrfreaks.net. Hope you all will find this useful. Darsh

More information

AVR Training Board-I. VLSI Design Lab., Konkuk Univ. LSI Design Lab

AVR Training Board-I. VLSI Design Lab., Konkuk Univ. LSI Design Lab AVR Training Board-I V., Konkuk Univ. Tae Pyeong Kim What is microcontroller A microcontroller is a small, low-cost computeron-a-chip which usually includes: An 8 or 16 bit microprocessor (CPU). A small

More information

AVR Microcontrollers Architecture

AVR Microcontrollers Architecture ก ก There are two fundamental architectures to access memory 1. Von Neumann Architecture 2. Harvard Architecture 2 1 Harvard Architecture The term originated from the Harvard Mark 1 relay-based computer,

More information

LAMPIRAN. Universitas Sumatera Utara

LAMPIRAN. Universitas Sumatera Utara LAMPIRAN 35 Features 2. High-performance, Low-power AVR 8-bit Microcontroller 3. Advanced RISC Architecture 131 Powerful Instructions Most Single-clock Cycle Execution 32 x 8 General Purpose Working Registers

More information

CN310 Microprocessor Systems Design

CN310 Microprocessor Systems Design CN310 Microprocessor Systems Design Microcontroller Nawin Somyat Department of Electrical and Computer Engineering Thammasat University Outline Course Contents 1 Introduction 2 Simple Computer 3 Microprocessor

More information

12. Interrupts and Programmable Multilevel Interrupt Controller

12. Interrupts and Programmable Multilevel Interrupt Controller 12. Interrupts and Programmable Multilevel Interrupt Controller 12.1 Features Short and predictable interrupt response time Separate interrupt configuration and vector address for each interrupt Programmable

More information

12.1. Unit 12. Exceptions & Interrupts

12.1. Unit 12. Exceptions & Interrupts 12.1 Unit 12 Exceptions & Interrupts 12.2 Disclaimer 1 This is just an introduction to the topic of interrupts. You are not meant to master these right now but just start to use them We will cover more

More information

Chapter 6 PROGRAMMING THE TIMERS

Chapter 6 PROGRAMMING THE TIMERS Chapter 6 PROGRAMMING THE TIMERS Lesson 3 Real Time Clocked Interrupts and Software Timers 2 Real Time Clock Interrupt 3 Real Time interrupts Prescaling Pre-scaling by RT1-RT0 bits for 4 or 8 or 16 2 13

More information

8-bit Microcontroller with 2K Bytes Flash. ATtiny26 ATtiny26L

8-bit Microcontroller with 2K Bytes Flash. ATtiny26 ATtiny26L Features High-performance, Low-power AVR 8-bit Microcontroller RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation

More information

8-bit Microcontroller with 8K Bytes In-System Programmable Flash. ATmega8515 ATmega8515L. Features

8-bit Microcontroller with 8K Bytes In-System Programmable Flash. ATmega8515 ATmega8515L. Features Features High-performance, Low-power AVR 8-bit Microcontroller RISC Architecture 130 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation

More information

8-bit Atmel Microcontroller with 8/16K Bytes In-System Programmable Flash AT90PWM81 AT90PWM161

8-bit Atmel Microcontroller with 8/16K Bytes In-System Programmable Flash AT90PWM81 AT90PWM161 Features High performance, low power Atmel AVR 8-bit Microcontroller Advanced RISC architecture 131 powerful instructions - most single clock cycle execution 32 8 general purpose working registers Fully

More information

The Atmel ATmega328P Microcontroller

The Atmel ATmega328P Microcontroller Ming Hsieh Department of Electrical Engineering EE 459Lx - Embedded Systems Design Laboratory 1 Introduction The Atmel ATmega328P Microcontroller by Allan G. Weber This document is a short introduction

More information

Interrupts Arduino, AVR, and deep dark programming secrets. What is an Interrupt?

Interrupts Arduino, AVR, and deep dark programming secrets. What is an Interrupt? Interrupts Arduino, AVR, and deep dark programming secrets What is an Interrupt? A transfer of program control that is not directed by the programmer Like a phone call in the middle of a conversation Stop

More information

EE 308: Microcontrollers

EE 308: Microcontrollers EE 308: Microcontrollers Timers Aly El-Osery Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA April 2, 2018 Aly El-Osery (NMT) EE 308: Microcontrollers

More information

8-bit Microcontroller with 4K Bytes In-System Programmable Flash. ATtiny40. Preliminary

8-bit Microcontroller with 4K Bytes In-System Programmable Flash. ATtiny40. Preliminary Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 54 Powerful Instructions Most Single Clock Cycle Execution 16 x 8 General Purpose Working Registers Fully Static

More information

Interrupts & Interrupt Service Routines (ISRs)

Interrupts & Interrupt Service Routines (ISRs) ECE3411 Fall 2015 Lecture 2c. Interrupts & Interrupt Service Routines (ISRs) Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: vandijk,

More information

AVR Microcontroller with Core Independent Peripherals and PicoPower technology

AVR Microcontroller with Core Independent Peripherals and PicoPower technology AVR Microcontroller with Core Independent Peripherals and PicoPower technology Introduction The picopower ATmega324PB is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture.

More information

ATmega8A. Introduction. Features. 8-bit AVR Microcontroller DATASHEET COMPLETE

ATmega8A. Introduction. Features. 8-bit AVR Microcontroller DATASHEET COMPLETE 8-bit AVR Microcontroller ATmega8A DATASHEET COMPLETE Introduction The Atmel ATmega8A is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions

More information

Marten van Dijk, Syed Kamran Haider

Marten van Dijk, Syed Kamran Haider ECE3411 Fall 2015 Lecture 3b. Timers 0, 1 & 2 Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: vandijk, syed.haider@engr.uconn.edu Based

More information

The Atmel ATmega168A Microcontroller

The Atmel ATmega168A Microcontroller Ming Hsieh Department of Electrical Engineering EE 459Lx - Embedded Systems Design Laboratory The Atmel ATmega168A Microcontroller by Allan G. Weber 1 Introduction The Atmel ATmega168A is one member of

More information

8-bit Atmel XMEGA D Microcontroller XMEGA D MANUAL

8-bit Atmel XMEGA D Microcontroller XMEGA D MANUAL This document contains complete and detailed description of all modules included in the Atmel AVR XMEGA D microcontroller family. The Atmel AVR XMEGA D is a family of low-power, high-performance, and peripheral-rich

More information

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega169V ATmega169. Features. Notice: Not recommended in new designs.

8-bit Microcontroller with 16K Bytes In-System Programmable Flash. ATmega169V ATmega169. Features. Notice: Not recommended in new designs. Features High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 130 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static

More information

8/16-bit Atmel AVR XMEGA Microcontrollers

8/16-bit Atmel AVR XMEGA Microcontrollers 8/16-bit Atmel AVR XMEGA Microcontrollers ATxmega32E5 / ATxmega16E5 / ATxmega8E5 DATASHEET Features High-performance, low-power Atmel AVR XMEGA 8/16-bit Microcontroller Nonvolatile program and data memories

More information

8-bit XMEGA D Microcontroller XMEGA D MANUAL. Preliminary

8-bit XMEGA D Microcontroller XMEGA D MANUAL. Preliminary This document contains complete and detailed description of all modules included in the AVR XMEGA TM D Microcontroller family. The XMEGA D is a family of low power, high performance and peripheral rich

More information

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interrupt Programming in Embedded C Module No: CS/ES/20 Quadrant 1 e-text

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interrupt Programming in Embedded C Module No: CS/ES/20 Quadrant 1 e-text e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interrupt Programming in Embedded C Module No: CS/ES/20 Quadrant 1 e-text In this lecture embedded C program for interrupt handling

More information

ADC: Analog to Digital Conversion

ADC: Analog to Digital Conversion ECE3411 Fall 2015 Lecture 5b. ADC: Analog to Digital Conversion Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk, syed.haider}@engr.uconn.edu

More information

APPLICATION NOTE. AT11008: Migration from ATxmega16D4/32D4 Revision E to Revision I. Atmel AVR XMEGA. Introduction. Features

APPLICATION NOTE. AT11008: Migration from ATxmega16D4/32D4 Revision E to Revision I. Atmel AVR XMEGA. Introduction. Features APPLICATION NOTE AT11008: Migration from ATxmega16D4/32D4 Revision E to Revision I Atmel AVR XMEGA Introduction This application note lists out the differences and changes between Revision E and Revision

More information

8-bit Microcontroller with 40K Bytes In-System Programmable Flash. ATmega406. Preliminary

8-bit Microcontroller with 40K Bytes In-System Programmable Flash. ATmega406. Preliminary Features High Performance, Low Power AVR 8-bit Microcontroller Advanced RISC Architecture 24 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static

More information

Unit 14 Timers and Counters 14.1

Unit 14 Timers and Counters 14.1 Unit 14 Timers and Counters 14.1 14.2 Counter/Timers Overview ATmega328P has two and one counters. Can configure to count at some frequency up to some value (a.k.a. ), generate an and counkng again, if

More information

8-bit Microcontroller with 2K Bytes Flash. ATtiny26 ATtiny26L. Preliminary. Features

8-bit Microcontroller with 2K Bytes Flash. ATtiny26 ATtiny26L. Preliminary. Features Features High-performance, Low-power AVR 8-bit Microcontroller RISC Architecture 118 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation

More information

ATmegaS128. Introduction. Features

ATmegaS128. Introduction. Features Rad-Tol 8-bit AVR Microcontroller, 3.3V, 8 MHz with 128 KB Flash, 4 KB EEPROM, 4 KB SRAM, 10-bit ADC, TWI, RTC, 16-bit PWM, USART, SPI and 16-bit Timer/Counter Introduction The ATmegaS128 is a low-power

More information

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices, Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices, CISC and RISC processors etc. Knows the architecture and

More information

AVR- M16 development board Users Manual

AVR- M16 development board Users Manual AVR- M16 development board Users Manual All boards produced by Olimex are ROHS compliant Rev. C, January 2005 Copyright(c) 2009, OLIMEX Ltd, All rights reserved Page1 INTRODUCTION AVR-M16 is header board

More information

SECTION 5 RESETS AND INTERRUPTS

SECTION 5 RESETS AND INTERRUPTS SECTION RESETS AND INTERRUPTS Resets and interrupt operations load the program counter with a vector that points to a new location from which instructions are to be fetched. A reset immediately stops execution

More information

MCU: Interrupts and Timers. Ganesh Pitchiah

MCU: Interrupts and Timers. Ganesh Pitchiah MCU: Interrupts and Timers Ganesh Pitchiah What s an MCU? Frequency = 8 MHz Time Period = 1/f = 0.125 us Code for Switching LED int a; voltage while(1) { a = PINA.0; input) If (a==1) PORTA.1=1; else PORTA.1=0;

More information

ATmega128A. Introduction. Features. 8-bit AVR Microcontroller DATASHEET COMPLETE

ATmega128A. Introduction. Features. 8-bit AVR Microcontroller DATASHEET COMPLETE 8-bit AVR Microcontroller ATmega128A DATASHEET COMPLETE Introduction The Atmel ATmega128A is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions

More information

8/16-bit Atmel XMEGA B3 Microcontroller

8/16-bit Atmel XMEGA B3 Microcontroller Features High-performance, low-power Atmel AVR XMEGA 8/16-bit Microcontroller Nonvolatile program and data memories 64K - 128K Bytes of in-system self-programmable flash 4K - 8K Bytes boot section 2K Bytes

More information

AVR097: Migration between ATmega128 and ATmega1281/ATmega bit Microcontrollers. Application Note. Features. 1 Introduction

AVR097: Migration between ATmega128 and ATmega1281/ATmega bit Microcontrollers. Application Note. Features. 1 Introduction AVR097: Migration between ATmega128 and ATmega1281/ATmega2561 Features General Porting Considerations Memory Clock sources Interrupts Power Management BOD WDT Timers/Counters USART & SPI ADC Analog Comparator

More information

An Arduino Controlled 1 Hz to 60 MHz Signal Generator

An Arduino Controlled 1 Hz to 60 MHz Signal Generator An Arduino Controlled 1 Hz to 60 MHz Signal Generator Greg McIntire, AA5C AA5C@arrl.net WWW..ORG 1 Objectives Build a standalone 60 MHz signal generator based on the DDS-60 board. Originally controlled

More information

Microcontroller Based Digital Clock

Microcontroller Based Digital Clock Daffodil International University Institutional Repository Electrical and Electronic Engineering Project Report of B.Sc in EEE 2014-07-08 Microcontroller Based Digital Clock Islam, Md. Tamzidul http://hdl.handle.net/20.500.11948/1052

More information

Microcontroller basics

Microcontroller basics FYS3240 PC-based instrumentation and microcontrollers Microcontroller basics Spring 2017 Lecture #4 Bekkeng, 30.01.2017 Lab: AVR Studio Microcontrollers can be programmed using Assembly or C language In

More information

ATxmega64D3 Automotive

ATxmega64D3 Automotive ATxmega64D3 Automotive 8/16-bit Atmel AVR XMEGA D3 Microcontroller DATASHEET Features High-performance, low-power Atmel AVR XMEGA 8/16-bit Microcontroller Nonvolatile program and data memories 64Kbytes

More information

Newbie s Guide to AVR Timers

Newbie s Guide to AVR Timers Newbie s Guide to AVR Timers Dean Camera November 5, 204 ********** Text Dean Camera, 203. All rights reserved. This document may be freely distributed without payment to the author, provided that it is

More information

timer 1 Fri Oct 13 13:00:

timer 1 Fri Oct 13 13:00: timer 1 Fri Oct 1 1:00: 1.1 Introduction SECTION CAPTURE/COMPARE TIMER This section describes the operation of the 1-bit capture/compare timer. Figure -1 shows the structure of the timer module. Figure

More information