EE3350 Lab1
Page 1
1) To download and install Keil 4.74, follow this link.
https://www.keil.com/demo/eval/armv4.htm
2) To download and install all the examples and simulators follow this link
http://edx-org-utaustinx.s3.amazonaws.com/UT601x/EE319K_InstallSpring2015.exe
Useful web sites
Valvanos web page EE319K material Data sheets
Book examples
C programming Setup Keil uVision Starter files
http://users.ece.utexas.edu/~valvano
http://users.ece.utexas.edu/~valvano/Volume1 (information specific to EE319K) http://users.ece.utexas.edu/~valvano/Datasheets/ http://users.ece.utexas.edu/~valvano/arm/ (example code from the book) http://users.ece.utexas.edu/~valvano/embed/toc1.htm http://users.ece.utexas.edu/~valvano/Volume1/uvision/ http://edx-org-utaustinx.s3.amazonaws.com/UT601x/EE319K_InstallSpring2015.exe
Reference: Valvano et Al,EE319K Laboratory Manual, Spring 2015
2/4/2019
Page 2 Embedded Systems: Introduction to ARM CortexTM-M Microcontrollers
Lab 1. Simulated IO: Digital Logic Implemented on a Microcontroller
Preparation
Read eBook Chapters 2-8
Install and run Keil uVision on your personal computer or in lab
Download, unzip, open, compile, and run these four projects (either in lab or on your personal computer)
http://edx-org-utaustinx.s3.amazonaws.com/UT601x/EE319K_InstallSpring2015.exe Labs 1-4
SimpleProject_xxxasm.zip GPIO_xxxasm.zip Switch_xxxasm.zip InputOutput_xxxasm.zip Lab1_EE319K.zip
Random number generator with no I/O
Simple output to Port D
Simple input from Port A, LED on Port F
More complex with inputs and outputs to Port F Starter project with links to grading engine
Purpose
The general purpose of this laboratory is to familiarize you with the software development steps using the uVision
simulator. Starting with Lab 2, we will use uVision for both simulation and debugging on the real board, but for this lab, we will use just the simulator. You will learn how to perform digital input/output on parallel ports of the LM4F120/TM4C123. Software skills you will learn include port initialization, logic operations, and unconditional branching.
System Requirements
The specific device you will create is a digital lock with two binary switch inputs and one LED output. The LED output represents the lock, and the operator will toggle the switches in order to unlock the door. Let PE2 (Port E bit 2) be the Boolean variable representing the lock (0 means LED is off and door is locked, 1 means LED is on and door is unlocked). Let PE3 (Port E bit 3 is one input switch) and PE4 (Port E bit 4 is a second switch) be Boolean variables representing the state of the two switches (1 means the switch is not pressed, and 0 means the switch is pressed). The LED should come on if both switches are pressed. The PE2=1 if and only if PE3=0 and PE4=0. The specific function you will implement is
PE2 = (not(PE3)) and (not(PE4)) Procedure
The basic approach to this lab will be to develop and debug your system using the simulator.
Part a) To create a Lab 1 Project, perform these tasks. Find a place on your harddrive to save all your LM4F120/TM4C123 software. In Figure 1.1 it is called LaunchPadware, but it will be EE319Kware when you install the .exe.
Figure 1.1. Directory structure with your Lab1 together with driverlib and inc directories.
Reference: Valvano et Al,EE319K Laboratory Manual, Spring 2015
02/04/19
EE3350 Lab1 Page 3
It is important for the directory structure to look like Figure 1.1. Download and unzip the starter configuration from http://edx-org-utaustinx.s3.amazonaws.com/UT601x/EE319K_InstallSpring2015.exe into this location. We will place our projects in folders like my Lab 1.
Find the four example projects listed above. Begin with the Lab1_EE319K project. Notice the folder for each project is in EE319Kware. Either double click the uvproj file or open the project from within uVision. Make sure you can compile it and run on the simulator. Please contact your TA if the starter project does not compile or run on the simulator. Startup.s contains assembly source code to define the stack, reset vector, and interrupt vectors. All projects in this class will include this file, and you should not need to make any changes to the Startup.s file. main.s will contain your assembly source code for this lab. You will edit the main.s file.
Figure 1.2. Start Keil by opening the Lab1.uvproj file.
You should rename the Lab1 starter folder to include your EIDs. Add your names and the most recent date to the comments at the top of main.s. This code shows the basic template for the first few labs. You will not need global variables in this lab.
THUMB
AREADATA, ALIGN=2
;global variables go here
ALIGN
AREA|.text|, CODE, READONLY, ALIGN=2
EXPORTStart
Start
;initialization code goes here
loop
;the body of the code goes here
B loop
ALIGN
END
Program 1.1. Assembly language template.
Reference: Valvano et Al,EE319K Laboratory Manual, Spring 2015
2/4/2019
Page 4 Embedded Systems: Introduction to ARM CortexTM-M Microcontrollers
To run the Lab 1 simulator, you must do two things. First, execute Project->Options and select the Debug tab. The debug parameter field must include -dEE319KLab1. Second, the EE319KLab1.dll file must be added to your KeilARMBIN folder. The debugging dynamic link libraries should go into KeilARMBIN when you install the .exe.
Figure 1.3. Two ways to debug the software using the simulator (DCM.DLL -pCM4 -dEE319KLab1).
Part b) Write a flow chart for this program. We expect 5 to 15 symbols in the flow chart.
Part c) Write pseudo code for this program. We expect 5 to 10 steps in the pseudo code. You may use any syntax you wish,
but the algorithm should be clear.
Part d) You will write assembly code that inputs from PE3 and PE4, and outputs to PE2. You can copy and paste the address definitions for Port E from the lm4f120.s or tm4c123gh6pm.s file (listed below).
GPIO_PORTE_DATA_R
GPIO_PORTE_DIR_R
GPIO_PORTE_AFSEL_R
GPIO_PORTE_DEN_R
GPIO_PORTE_AMSEL_R
GPIO_PORTE_PCTL_R
SYSCTL_RCGC2_R
EQU 0x400243FC
EQU 0x40024400
EQU 0x40024420
EQU 0x4002451C
EQU 0x40024528
EQU 0x4002452C
EQU 0x400FE108
The opening comments include: file name, overall objectives, hardware connections, specific functions, author name, TA, and date. The equ pseudo-op is used to define port addresses. Global variables are declared in RAM, and the main program is placed in EEPROM. The 32-bit contents at ROM address 0x00000004 define where the computer will begin execution after a power is turned on or after the reset button is pressed.
;****************** main.s *************** ; Program written by: Your Names
; Date Created: 8/25/2014
; Last Modified: 8/25/2014
; Section 1-2pm TA: Wooseok Lee
; Lab number: 1
; Brief description of the program
; The overall objective of this system is a digital lock ; Hardware connections
; PE3 is switch input (1 means switch is not pressed, 0 means switch is pressed)
; PE4 is switch input (1 means switch is not pressed, 0 means switch is pressed)
; PE2 is LED output (0 means door is locked, 1 means door is unlocked) ; The specific operation of this system
; unlock if both switches are pressed
Program 1.2. Required comments at the top of every file.
Reference: Valvano et Al,EE319K Laboratory Manual, Spring 2015
02/04/19
EE3350 Lab1 Page 5
One student should write the flowchart, and the other student should write the pseudo code. Students should work together for the other parts.
To interact with the I/O during simulation, execute the Peripherals->TExaS Port E command. When running the simulator, we check and uncheck bits in the I/O Port box to change input pins (1) and (2). We observe output pins in the window (3). You can also see the other DIR AFSEL DEN and PUR registers. To have the simulator test your Lab 1 solution, click the Grade button (4). Your score will be shown in the Score box (5). The Grading Controls are for the MOOC and are not used for any part of you grade in EE319K this semester
Figure 1.4. In simulation mode, we interact with virtual hardware.
Demonstration
During the demonstration, you will be asked to run your program to verify proper operation. You should be able to single step your program and explain what your program is doing and why. You need to know how to set and clear breakpoints. You should know how to visualize Port E input/output in the simulator.
Deliverables (Items 1-4 are one pdf file uploaded to Canvas, have this file open during demo.)
0) Lab 1 grading sheet. You can print it yourself or pick up a copy in lab. You fill out the information at the top. 1) Flowchart of the system
2) Pseudo code for the algorithm
3) Assembly source code of your final main.s program
4) One screen shot of the Port E window, showing PE2, PE3, and PE4 showing the case with the LED on.
Reference: Valvano et Al,EE319K Laboratory Manual, Spring 2015
2/4/2019
Reviews
There are no reviews yet.