Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment You need to turn your Arduino and LCD into a frequency counter. The operation of a frequency counter is exactly what the phrase implies-it
Assignment You need to turn your Arduino and LCD into a frequency counter. The operation of a frequency counter is exactly what the phrase implies-it determines the frequency of an input signal source (in Hz) and displays that to the user. Assume the input signal will be a TTL-level square wave Your program should be constructed to use a timer interrupt to measure elapsed time. Typical frequency counters use different 'integration' times depending on the frequency range that has beern selected. Lower frequencies require a longer integration time in order to get an accurate sample. Your program should support two different integration times: a 100 millisecond period and a 500 millisecond period. Use digital l/O pin 3 to select between the two periods; if the pin is held low, then the longer period is to be used. You may use a jumper wire to pull the I/O line low if you don't have a switch Note: The prototyping board the TAs will be using to test your code will not have external pullup resistors on any of the I/O lines, so plan accordingly The input signal pulses should be detected using an external interrupt (digital I/O pin 2). At the end of each integration interval, your program should calculate the average input signal frequency detected over the interval; the LCD should then be updated to display the frequency in Hertz. You should assume that the frequency of the input signal may be changing over time, but will do so relatively slowly. Construct your code so that the ISRs are tasked with keeping track of those things that need to happen in real-time. Updating the LCD takes (relatively) a long time and thus is an 'expensive' operation. As a result it's not something you should do while in the ISR -instead, the updating of the LCD should happen in loop(). Also, the code in loop() should not update the LCD unnecessarily (that would be a waste of machine resources) The LCD display should indicate the range in which your frequency is operating: Low (using the longer integration period) or High (using the shorter period). The exact layout of the LCD screen is up to you, but the information being displayed should be intuitively obvious to the user It should be possible to switch between the integration periods without having to restart the program Assignment You need to turn your Arduino and LCD into a frequency counter. The operation of a frequency counter is exactly what the phrase implies-it determines the frequency of an input signal source (in Hz) and displays that to the user. Assume the input signal will be a TTL-level square wave Your program should be constructed to use a timer interrupt to measure elapsed time. Typical frequency counters use different 'integration' times depending on the frequency range that has beern selected. Lower frequencies require a longer integration time in order to get an accurate sample. Your program should support two different integration times: a 100 millisecond period and a 500 millisecond period. Use digital l/O pin 3 to select between the two periods; if the pin is held low, then the longer period is to be used. You may use a jumper wire to pull the I/O line low if you don't have a switch Note: The prototyping board the TAs will be using to test your code will not have external pullup resistors on any of the I/O lines, so plan accordingly The input signal pulses should be detected using an external interrupt (digital I/O pin 2). At the end of each integration interval, your program should calculate the average input signal frequency detected over the interval; the LCD should then be updated to display the frequency in Hertz. You should assume that the frequency of the input signal may be changing over time, but will do so relatively slowly. Construct your code so that the ISRs are tasked with keeping track of those things that need to happen in real-time. Updating the LCD takes (relatively) a long time and thus is an 'expensive' operation. As a result it's not something you should do while in the ISR -instead, the updating of the LCD should happen in loop(). Also, the code in loop() should not update the LCD unnecessarily (that would be a waste of machine resources) The LCD display should indicate the range in which your frequency is operating: Low (using the longer integration period) or High (using the shorter period). The exact layout of the LCD screen is up to you, but the information being displayed should be intuitively obvious to the user It should be possible to switch between the integration periods without having to restart the program
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