Question: Microcontrollers- PSOC 4 4. You are designing a measuring system using the time for an ultrasonic echo to return to determine distance. A separate team

Microcontrollers- PSOC 4

Microcontrollers- PSOC 4 4. You are designing a measuring system using the

4. You are designing a measuring system using the time for an ultrasonic echo to return to determine distance. A separate team has developed a sensor that (1) outputs an ultrasonic signal when a rising edge is created on pin P2[4] and (2) creates a rising edge on P2|5] when its echo returns. Your system will signal the ultrasonic emitter to send a signal once per second and determine the distance to the object in meters. The speed of sound at sea level in air is 343 m/s. Because the signal has to make a round-trip, the formula for distance is distance (time in seconds) 343/2, or (time in milliseconds)* 0.343/2. The maximum time for the echo is 500 ms. Your design must use timer capture interrupts. The capture ISR will compute the distance in meters and write it in the global variable distance. i) Design the timer Name: UltraSonicTimer Clock input frequency: Period: Generate interrupt on terminal count? Y/N Generate interrupt on compare/capture? Y/N Any inputs? What type? What are they connected to? Write the capture ISR for UltraSonicTimerint. Indicate any global variables that you are using and be sure to define them in main. The ISR must compute the value for distance in meters but does not have to display it. ii) i) Write the main program including any setup you need to do for the timer. Your main loop should signal the ultrasonic emitter (using P2[4]) once per second. You may use CyDelay for timing in this loop. You do not need to display the value of the distance variable. 4. You are designing a measuring system using the time for an ultrasonic echo to return to determine distance. A separate team has developed a sensor that (1) outputs an ultrasonic signal when a rising edge is created on pin P2[4] and (2) creates a rising edge on P2|5] when its echo returns. Your system will signal the ultrasonic emitter to send a signal once per second and determine the distance to the object in meters. The speed of sound at sea level in air is 343 m/s. Because the signal has to make a round-trip, the formula for distance is distance (time in seconds) 343/2, or (time in milliseconds)* 0.343/2. The maximum time for the echo is 500 ms. Your design must use timer capture interrupts. The capture ISR will compute the distance in meters and write it in the global variable distance. i) Design the timer Name: UltraSonicTimer Clock input frequency: Period: Generate interrupt on terminal count? Y/N Generate interrupt on compare/capture? Y/N Any inputs? What type? What are they connected to? Write the capture ISR for UltraSonicTimerint. Indicate any global variables that you are using and be sure to define them in main. The ISR must compute the value for distance in meters but does not have to display it. ii) i) Write the main program including any setup you need to do for the timer. Your main loop should signal the ultrasonic emitter (using P2[4]) once per second. You may use CyDelay for timing in this loop. You do not need to display the value of the distance variable

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!