Embedded Microcomputer Systems Exam 1 - Spring 2003, Exams of Electrical and Electronics Engineering

The questions and instructions for exam 1 of the embedded microcomputer systems course held in spring 2003. The exam covers topics such as finite state machines (fsms), interrupts, and debugging techniques. Students are required to write answers on the exam pages and show their calculations.

Typology: Exams

Pre 2010

Uploaded on 08/19/2009

koofers-user-oi6
koofers-user-oi6 🇺🇸

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Embedded Microcomputer Systems
Exam 1 – Spring 2003
Do NOT write your name on this page. Write your name on the back of the last page of this exam.
Open book and open notes. Answer on these pages only, using the back of the page if necessary. Show
all of your calculations; don’t make me guess how you arrived at your answer. Read the entire exam
before proceeding.
1. (40) This Moore FSM controls traffic at an intersection. The 2-bit inputs and the 6-bit outputs are
given in binary. The wait times are given in seconds. The controller sequence is: output, wait, input, and
jump to next state, depending on the input. You are allowed to make minor modifications to the linked
structure, as long as the original FSM is implemented. Port C bits 1,0 are sensor inputs, and Port B bits 5-
0 are traffic light outputs.
goN
100001
30
waitN
100010
5
goE
001100
30
waitE
010100
5
00,01,10,11
01,11 00,01,
10,11 01,11
00,01
00,10
wait time
const struct State {
unsigned char Out; /* Output to Port B */
unsigned short Time; /* Time in sec to wait */
const struct State *Next[4]; /* Next if input=00,01,10,11 */
};
typedef const struct State StateType;
#define goN &fsm[0]
#define waitN &fsm[1]
#define goE &fsm[2]
#define waitE &fsm[3]
StateType fsm[4] = {
{0x21, 30, {goN,waitN,goN,waitN}}, /* goN state */
{0x22, 5, {goE,goE,goE,goE}}, /* waitN state */
{0x0C, 30, {goE,goE,waitE,waitE}}, /* goE state */
{0x14, 5, {goN,goN,goN,goN}} /* waitE state */
};
Write your answers on the next page ->
Page 1 of 4
pf3
pf4

Partial preview of the text

Download Embedded Microcomputer Systems Exam 1 - Spring 2003 and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

Exam 1 – Spring 2003

Do NOT write your name on this page. Write your name on the back of the last page of this exam.

Open book and open notes. Answer on these pages only, using the back of the page if necessary. Show all of your calculations; don’t make me guess how you arrived at your answer. Read the entire exam before proceeding.

  1. (40) This Moore FSM controls traffic at an intersection. The 2-bit inputs and the 6-bit outputs are given in binary. The wait times are given in seconds. The controller sequence is: output, wait, input, and jump to next state, depending on the input. You are allowed to make minor modifications to the linked structure, as long as the original FSM is implemented. Port C bits 1,0 are sensor inputs, and Port B bits 5- 0 are traffic light outputs.

goN

waitN

goE

waitE

wait time

const struct State { unsigned char Out; /* Output to Port B / unsigned short Time; / Time in sec to wait */ const struct State Next[4]; / Next if input=00,01,10,11 / }; typedef const struct State StateType; #define goN &fsm[0] #define waitN &fsm[1] #define goE &fsm[2] #define waitE &fsm[3] StateType fsm[4] = { {0x21, 30, {goN,waitN,goN,waitN}}, / goN state / {0x22, 5, {goE,goE,goE,goE}}, / waitN state / {0x0C, 30, {goE,goE,waitE,waitE}}, / goE state / {0x14, 5, {goN,goN,goN,goN}} / waitE state */ };

Write your answers on the next page ->

Exam 1 – Spring 2003

The FSM controller must run in the background using output compare, RTI, or TOF interrupts. Part a) Show the ritual that initializes the traffic light system. The initial state is goN. The main program, which you do not write, will call the ritual, and then perform other unrelated tasks.

Part b) Show the ISR that runs the controller in the background.

Exam 1 – Spring 2003

  1. (15) In this problem consider the following two C functions void Ritual0(void) { DDRH = DDRH | 0x01; //PORTH bit 0 is output } void Ritual1(void) { DDRH = DDRH | 0x02; //PORTH bit 1 is output } Do these two functions have critical sections? I.e., consider the sequence where one of these functions is started (running with interrupts enabled), this first function then is interrupted, the other function is called from the interrupt service routine, and after the interrupt service routine finishes, the first function is completed. Be very specific and justify your answer.
  2. (15) Consider the following LED interface to the 6812. Assume that the voltage drop across the LED, when active, will be 2.0 v. Justify/explain your answers. Show all of your calculations. (a) What is the largest possible LED current that the 6812 can drive in this circuit? (b) Assuming the LED needs 500 μA to activate, what resistor value should you use?

6812

PJ

+5 v

R