Question: Question 1: Shutdown system (20 pts) A pressure sensor is embedded in the ramp below. When pressure is applied to the sensor, a logic 1

Question 1: Shutdown system (20 pts) A pressure sensor is embedded inQuestion 1: Shutdown system (20 pts) A pressure sensor is embedded in the ramp below. When pressure is applied to the sensor, a logic 1 is driven on the Timer 1 Input Capture input wire of the TM4C123, else a logic 0 is driven. You are to write a C-program that will apply the cars breaks to stop it if its velocity is not large enough to jump the gap shown below. This program is required to use the Timer 1 Input Capture interrupt. Assumptions: 1) The car is moving at a constant velocity while on the ramp 2) The car is treated as a point mass for computing the physics of the problem

a) Complete Config_Timer1 to program the Timer 1 configuration registers as follows: (5 pts)

Input Capture interrupt enabled

24-bit timer

Detect positive edge events

Config_Timer1()

{

// YOUR CODE HERE

}

b) Complete the ISR (i.e. handler) called Timer_1_Handler to store first_wheel_hit and second_wheel_hit (5 pts)

c) Complete Stop_car(). It should return 1 if the car is not moving fast enough to jump the gap (5 pts)

// Global variables (you may use additional variables)

volatile unsigned int first_wheel_hit; // When 1st wheel hits sensor

volatile unsigned int second_wheel_hit; // When 2nd wheel hits sensor

volatile int done_flag=0; // 1 after both first and second_wheel_hit

// have been stored

// Store first_wheel_hit and second_wheel_hit

void Timer_1_Handler(void)

{

//YOUR CODE HERE

}

// Return 1 if the car is not fast enough to jump the gap

int Stop_car(void)

{

//YOUR CODE HERE

}

// Program to stop Car if it is not fast enough to jump

// the gap.

main()

{

int stop = 0;

Config_Timer1();

while(1)

{

// Wait for events to be captured

while(!done_flag)

{

}

done_flag = 0; // Clear flag

// Check if car needs to stop

stop = Stop_car();

if(stop)

{

lprintf(Stopping Car!;

}

else

{

lprintf(Car going to Jump!!);

}

} // end while

}

Question 1: Shutdown system (20 pts) A pressure sensor is embedded in the ramp below. When pressure is applied to the sensor, a logic 1 is driven on the Timer 1 Input Capture input wire of the TM4C123, else a logic 0 is driven. You are to write a C-program that will apply the car's breaks to stop it if its velocity is not large enough to jump the gap shown below. This program is required to use the Timer 1 Input Capture interrupt. Assumptions: 1) The car is moving at a constant velocity while on the ramp 2) The car is treated as a "point mass" for computing the physics of the problem Pressure Sensor 100 m 100 m Water TM4C123 45 100 m Question 1: Shutdown system (20 pts) A pressure sensor is embedded in the ramp below. When pressure is applied to the sensor, a logic 1 is driven on the Timer 1 Input Capture input wire of the TM4C123, else a logic 0 is driven. You are to write a C-program that will apply the car's breaks to stop it if its velocity is not large enough to jump the gap shown below. This program is required to use the Timer 1 Input Capture interrupt. Assumptions: 1) The car is moving at a constant velocity while on the ramp 2) The car is treated as a "point mass" for computing the physics of the problem Pressure Sensor 100 m 100 m Water TM4C123 45 100 m

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!