Question
1. Enabling and disabling INT0 and INT 1 Interrupts a. Show how to update the register GICR to enable both INT0 and INT1 external interrupts.
1. Enabling and disabling INT0 and INT 1 Interrupts
a. Show how to update the register GICR to enable both INT0 and INT1 external interrupts.
b. Show how to update the register GICR to disable both INT0 and INT1 external interrupts. 2. Configuring INT0 and INT1 Interrupts
Assume that interrupts are enabled for pins INT0 and INT1. Show how to configure the register MCUCR in order to achieve the following
a. Both INT0 and INT1 Interrupts are generated when there is a rising edge.
b. INT0 interrupt is generated when there is a falling edge while INT1interrupt is generated when there is any logical change on the pin 3. An AVR ATMEGA8 is clocked at 500 kHz, Timer 1 is used with no prescaler and with Zero reload value (T = 0). What is the number of Timer 1 overflows (X) required to create a delay of 2 seconds. 4. If the input frequency is 3686400 Hz, Timer0 is set to interrupt the microcontroller when an overflow occurs. The pre-scalar used is N = 1024. What is the reload value (T) to be used with Timer0 to have an interrupt rate of 20 Hz 5. The ATMega8 microcontroller is connected to a switch at pin INT0, and to a LED at bit 4 of PORTB. Write a complete C program such that when the switch changes from 1 to 0, then an interrupts will be generated and the ISR will toggle the LED accordingly. 6. Consider two switches SW0 and SW1 connected respectively to the external interrupts pin INT0 and INT1 of an ATMega8 AVR. A 7-segment display with decoder is connected to port PC0-PC3 on the same AVR. We require that when SW0 is pressed, the number displayed on the 7-segment display is incremented and when SW1 is pressed, the 7-segment display is decremented. Write a complete C program that implements the desired functions 7. Write a C program to generate a 16kHz PWM signal that has 40% duty cycle using Timer2 of an ATMega8 microcontroller.
8. Consider a push button switch SW0 connected to pin INT0 external interrupts of an ATMega8 AVR. 8 LEDS are connected to port PB0-PB7 on the same AVR. These LEDS are connected such a lit LED displays that the output port is on logic level 1. On start-up, TASK1 is executed and continue indefinitely. If the push-button switch SW0 is pressed, TASK1 is paused and TASK2 is carried out after which TASK1 is resumed. ? TASK1- A roll action is performed using the LEDs: The first LED is lit and roll down to the last LED then back to the first LED. This operation is done indefinitely. ? TASK2- ALL the LEDs blink five (5) times. Write a complete C program that implements the desired tasks
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started