Digital Systems Design lab report

profilemustafa88
electrical_engineering_lab_report_7.docx

Name:

Date: 11/17

Course: Digital Systems Design (EECS 3350),
Lab 7

Grading Element

Maximum Points

Your Points

Objective

5%

Procedure

5%

Results

75%

Discussion

5%

Conclusion

5%

Spelling/ Grammar

5%

Total

100%

Comments: ___________________________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________ ______________________________________________________________________________

Instructor:

1: Objective, Procedure

* To learn how build a prototype for a basic traffic light controller system and the port has been verified as : Port E will be used for detecting traffic and Port B will be used as signaling the traffic light outputs. Following are the inputs for traffic detection: 1. PE1=0, PE0=0 means no cars exist on either road 2. PE1=0, PE0=1 means there are cars on the East road 3. PE1=1, PE0=0 means there are cars on the North road 4. PE1=1, PE0=1 means there are cars on both roads.

Lab Requirements

1- TM4C123G kit

2- one breadboard,

3- six LEDs,

4- two 10K ohm and six 470 ohm resistors

5- bunch of small wire pieces

2. Results & Code:

}

// represents a State of the FSM

struct State {

unsigned char out ;

unsigned long wait ;

unsigned char next[4];

// output for the state

// Time to wait when in this state

// Next state array

};

//typedef const struct State StateType;

#define goN 0

#define waitN 1

#define goE 2

#define waitE 3

//The data structure that captures the FSM state transition graph

struct State Fsm[4] = {

/**************** YOUR CODE ***************/

{0x21, 5000, {goN, waitN, goN, waitN}},

{0x22, 1000, {goE, goE, goE, goE}},

{0x0C, 5000, {goE, goE, waitE, waitE}},

{0x14, 1000, {goN, goN, goN, goN}}

};

unsigned char cState;

unsigned long Input ;

int main(void){

/**************** YOUR CODE ***************/

// Initialize cState with goN

PortB_Init();

PortE_Init();

PLL_Init();

SysTick_Init();

cState = goN ;

while(1){

GPIO_PORTB_DATA_R = Fsm[cState].out; // Assign the GPIO_PORTB_DATA_R with the current fsm state out

SysTick_Wait1ms(Fsm[cState].wait); // Invoke SysTick_Wait10ms() with current fsm state wait argument

Input = GPIO_PORTE_DATA_R & 0x03; // Read the GPIO_PORTE_DATA_R register in an Input variable to

cState = Fsm[cState].next[Input];

// get the input for traffic

// 'ANDing' the input with 0x03 to retrieve the value of PE1 and PE0

// Assign the cState with the value of current state's next state

}

/**************** YOUR CODE ENDS ***************/

}

3. Discussion, Conclusion

The purpose of this lab is to learn how we could write a prototype program for a traffic light and learn how to control of all the process that the system been throw. Furthermore, I work with different group for this lab, the first group we were not doing very well and I did not understand the state that the program usually works on, I started to rework the lab with Alan and we had a lot of questions, after we build our code It did not work very well, but after consulting our instructor, we had to defined our data and get understand the situation for the traffic light and getting know how the goN and waitN work also, knowing the time that makes the program move from state to the other. In addition, we know how to use the stricture type and how to use the int and char function inside the struct situation. However, after building our board and contacted it like the instruction in the lab, we find that our code does not work correctly we had a problem in the yellow LED, but after replacing it , our code work correctly.

It was a very hard lab to complete and I took a lot of time to understand it and I hope we did a good jab, also, I’m looking forward to work on lab 8.

Thank you

Digital Systems Design

EET 3350

Instructor: