Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer the following true/false questions To get maximum resolution, the clock required for the ADC should be in the range 50 200KHz (T / F)

Answer the following true/false questions

To get maximum resolution, the clock required for the ADC should be in the range 50 200KHz (T / F)

For 8-bit timers, the maximum count is always equal to the top value regardless of the operation mode (T / F)

For the 16-bit timer1, the top value can be stored in ICR1 and the duty cycle can be controlled by writing to register OCR1A and OCR1B for channels A and B, respectively (T / F)

All or the majority of the MCU pins support PCINT, i.e., pin change interrupt (T / F)

EIMSK is the external interrupt mask register (T / F)

EICRA is the external interrupt control register A (T / F)

Atmega 328P has 2K bytes of RAM memory (T / F)

Atmega 328P has 64K bytes of FLASH memory (T / F)

The maximum rated speed (frequency) is 20MHz (T/ F)

The maximum operating voltage for the MCU is 5.5V (T/ F)

2. Choose a single correct answer for the following questions

How many timers does the MCU have?

i. One ii. Two ii. Three iv. Four

A PWM signal with frequency 10KHz and duty cycle 35% will have the ON time (in a single period) equal to:

i. 35ms ii. 35us iii. 35ns iv. None listed

If the MCU is running on a 1MHz clock and it is desired to program a 16-bit timer, to implement a 8KHz PWM in phase-correct PWM mode using ICR1 to store the top value and using a prescaler of clkuo / 8, what number should be stored in ICR1?

i. 1 ii. 8 iii. 1250 iv. 125 v. None listed

d. To program the MCU using WinAVR, for ADC conversion end complete interrupt, which ISR vector should be used?

i. ADC_ISR ii. ISR ADC iii. ADC_vect iv. Complete_ADC

Use the following information for questions 3 and 4 to follow. Note that ATmega 328P MCU is assumed.

A differential-drive (two wheels) robot competition is to be held in which identical autonomous robots race around an elliptical path (see figure below) collecting tiny colored flat objects. The robots will use various sensors to either detect the path marked or detect the distance in front, to the left and to the right of the robot. The robot will avoid collisions (as much as possible), collect objects and move in clockwise direction. Once programmed, each robot will wait for a start signal to be given by an IR remote control and will keep going around the elliptical path collecting objects until another IR signal is received which will force it to stop. The entire track is bounded by raised boundaries and therefore, robots can use distance sensors to avoid collision and navigate. Alternatively, robots can use the black line (in the middle of the track) to navigate.

The elliptical path contains tiny objects of various colors (Yellow, Green, Blue and Red). The robot is supposed to collect only Green and Blue objects). Picking up Red or Yellow objects will lead to penalty points.

image text in transcribed

Assume the following:

One RGB sensor to be placed at the bottom of the robot chassis. It has three analog outputs (R., G., B.) one for each color and requires 5V and GND to operate. The sensor covers about 2cmX2cm squares (just about the size of the objects). 8-bit analog ADC will be used. R., G. and B. should be connected to PCO, PC1 and PC2, respectively.

A special digital object collector to be placed at the bottom of the robot chassis and operates on 5V and GND. When a pulse of 1ms appears at its input pin it collects (picks up) any object beneath the robot chassis. Once activated to collect an object, the robot must wait for 2 seconds before issuing another pick up. When collection is complete, it outputs a single 1 ms pulse on C.. l,,, should be connected to PDO and C. to PBO.

One digital IR (infra red) receiver to be placed facing the back of the robot. The receiver has an active low output (IRour), i.e., when an IR signal from a remote control (TV, VCR, etc.) is received, it outputs a logic zero. IRour should be connected to PB1.

The MCU is connected to a motor driver that can provide the two motors with the required current. MCU control signals 001A and 0C1B are connected to the motor driver

o 1)Three analog IR sensors, I RRght , IRu,ddie and IR. are to be placed at the bottom of the robot chassis to detect the black line. I RRIg. IR.. and IR. should be connected to PC3 and PC4 and PC5, respectively. One special analog distance sensor (5 a 60cm). The sensor requires 5V and GND to operate and gives a single analog output (Dour) in the range 0.A 5V. The voltage is related to (not as cousin) the distance according to the equation: Distance (in cm) = 11 x V + 5. The sensor should be connected to PC6. The sensor can be used to avoid collision with other robots

o 2)Three special analog distance sensors (5 a 60cm). Each sensor requires 5V and GND to operate and gives a single analog output (Dow) in the range 0.A 5V. The voltage is related to (not as cousins) the distance according to the equation: Distance (in cm) = 11 x V +

5. The sensors can be used to avoid collision with other robots. Dow should be connected to PC3, PC4 and PC5, respectively.

3. Hardware:

Draw a block diagram of the robot showing all attached sensors and where they are positioned.

Draw the MCU showing all pins connected to the various sensors. Label all pins and sensor inputs/outputs

4. It is desired to write an interrupt driven software for the robot. Two global variables namely, currentStatus and previousStatus should be declared that represent the current and previous state of the robot. Initially, both should be set to STOPPED. The robot can have several states (for example, STOPPED, MOVING, COLLECTING, etc.). Write the following:

C function to initialize all I/O ports

C function to initial the ADC

C function to read from any ADC channel

C function to initialize timer interrupt every 10ms

C function to setup PWM to control two motors

Interrupt Service Routine (ISR) for the above (part c) timer interrupt. The ISR should monitor the various sensors and change the values of the global variables to facilitate the main C function to navigate the robot, collect objects, avoid collision, etc.

Complete C program (along with other supporting functions) for the robot to be able to participate in the competition. The program should enable the robot to start navigating in a clockwise direction, collect appropriate color objects and avoid collisions (cannot be completely avoided) and stop when commanded to do so through a remote control.

Raised above robot height Black Line

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions