Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab exp#5: Interrupts For Microcontroller AVR Atmega328p writing code on (C program code + ISIS) A car park has two gates, one for entering cars
Lab exp#5: "Interrupts"
For Microcontroller AVR Atmega328p writing code on
(C program code + ISIS) A car park has two gates, one for entering cars and the
other for leaving cars. When a car enters the parking area, a pressure
sensor activates a switch that is connected to pin INT0 which generates
external interrupt to open the enterance gate (LED at pin PC2) for the car to enter.
When a car exits the parking area, a pressure
sensor activates a switch that is connected to pin INT1 which generates
external interrupt to open the exit gate (LED at pin PC4) for the car to leave.
Define a glabal variable 'ncars' to hold the number of cars in the
parking area. If 'ncars' reaches 10, then disable the external interrupt
INT0 to prevent more cars from entering and turn on an LED on pin PB5
to show that there is no vacancy in the parking area. When 'ncars' gets
below 50, then enable the external interrupt INT0.
The system should always display 'ncars' on the PC screen every
5 seconds. This should be done via interrupt of TC1 to produce
the 5-seconds delay.
C program code
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