Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose you are using a robot that has light sensors on its right and left sides, as shown. The light sensors are connected to analog

Suppose you are using a robot that has light sensors on its right and left sides, as shown.

image text in transcribed

The light sensors are connected to analog input channels 1 and 9 of the TM4C ADC (channel 1 left sensor; channel 9 right sensor). Thus your program should sample both channels.

a. Initialize the ADC to use the channels as indicated. No interrupts are to be used. (7 pts)

i. Briefly describe the initialization tasks at a high level (at a higher level than C code or comments). What features need to be initialized and for what purpose? Do not provide specific register macros or bitwise operations.

ii. Next, write the code.

void init_ADC()

{

YOUR CODE HERE (suggestion: you may want to structure your code similar to the UART initialization given in question 3)

}

b. Complete the following function to read in the light sensor values and return them via the parameters. Use polling (i.e. no interrupt service routines). (5 pts)

void get_sensor_reading(int *left_sensor, int *right_sensor)

{

YOUR CODE HERE

}

The following is the UART initialization code from question 3:

image text in transcribed

image text in transcribed

Turn away from light Front Robot Back Turn away from light Front Robot Back

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

How do containers help to facilitate intermodal transportation?

Answered: 1 week ago