Microprocessors Lab: Learning C Programming and PIO Interfacing (Fall 2007), Lab Reports of Microprocessors

Lab 4 of the e 332l microprocessors course from boise state university, focusing on learning c programming language and interfacing with buttons, switches, and leds using nios ii. Students are required to debug source files, understand the given code, and complete an assignment to convert switch values to bcd and display them on seven-segment leds.

Typology: Lab Reports

Pre 2010

Uploaded on 09/17/2009

koofers-user-ily
koofers-user-ily 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Page 1 of 1
E 332L Microprocessors Lab (Fall 2007)
– Lab 4 (Week 6)–
Objective: In this lab, you will learn C programming language and the use of C for interfacing to buttons,
switches, and LEDs.
Note 1: Use Lab 4’s sof and ptf files.
Note 2: KEY0 is processor’s reset. KEY1 (called button1 in Nios II) is level-sensitive button. KEY2 is rising-edge
sensitive button. KEY3 is rising-edge with interrupt button.
Note 3: Create a Hello World C/C++ Nios II Application project, compile this project to obtain the system.h.
system.h is in your_project_name_syslib
debug
system_description
system.h. Then, add your sources
to the project. Remember, you can’t have more than one main in a project!
Part 1: Learn C Programming Language by Examples
Debug (Use Debug As
Nios II Instruction Set Simulator) the following source files. Document your
understanding of the given source files by commenting everything. You will/might need references in this page:
http://coen.boisestate.edu/smloo/ece332fall2007/tutorial.htm. In the debugger, use “Step Into” and/or “Step Over”.
Observe the assembly code in the Disassembly window and memory usage in the Memory Monitor.
Example of a commented line:
typedef unsigned char byte; // make our own data types
Question: There is a main in our source code. Why is there an alt_main in debug session?
The sources files you need to comment are:
a. types.c
b. suspect.c
c. main.c, sub1.h, sub1.c, sub2.h, and sub2.c.
Part 2: PIO Interfacing using C
This segment of code use pointer to read from switches and display the read value to red (led_switches.c).
Assignment: You need to convert the value from the switches to BCD and display this value to seven-segment
LEDs.

Partial preview of the text

Download Microprocessors Lab: Learning C Programming and PIO Interfacing (Fall 2007) and more Lab Reports Microprocessors in PDF only on Docsity!

Page 1 of 1

E 332L Microprocessors Lab (Fall 2007)

– Lab 4 (Week 6)–

Objective: In this lab, you will learn C programming language and the use of C for interfacing to buttons,

switches, and LEDs.

Note 1: Use Lab 4’s sof and ptf files.

Note 2: KEY0 is processor’s reset. KEY1 (called button1 in Nios II) is level-sensitive button. KEY2 is rising-edge sensitive button. KEY3 is rising-edge with interrupt button.

Note 3: Create a Hello World C/C++ Nios II Application project, compile this project to obtain the system.h. system.h is in your_project_name_syslib  debug  system_description  system.h. Then, add your sources to the project. Remember, you can’t have more than one main in a project!

Part 1: Learn C Programming Language by Examples

Debug ( Use Debug As  Nios II Instruction Set Simulator ) the following source files. Document your understanding of the given source files by commenting everything. You will/might need references in this page: http://coen.boisestate.edu/smloo/ece332fall2007/tutorial.htm. In the debugger, use “ Step Into ” and/or “ Step Over ”. Observe the assembly code in the Disassembly window and memory usage in the Memory Monitor.

Example of a commented line:

typedef unsigned char byte; // make our own data types

Question: There is a main in our source code. Why is there an alt_main in debug session?

The sources files you need to comment are: a. types.c b. suspect.c c. main.c, sub1.h, sub1.c, sub2.h, and sub2.c.

Part 2: PIO Interfacing using C

This segment of code use pointer to read from switches and display the read value to red (led_switches.c).

Assignment: You need to convert the value from the switches to BCD and display this value to seven-segment LEDs.