Beruflich Dokumente
Kultur Dokumente
DEPARTMENT OF
ELECTRICAL AND ELECTRONICS ENGINEERING
EEM 489 Microprocessors II
Fall, 2014-2015
Lab 3 Report
Date: 31.10.2014
EZG TETK 36151392336
Mahmut Ferit YILDIZ 53206053790
Alper KAPITAI 15529041298
1.)Purpose
The purpose of Lab 4 is to learn minimally intrusive debugging
skills and some software skills. One of these skills is called dump that
allows the program to capture strategic information which will will be
viewed at a some definite later time. The other one of these skills is
heartbeat . Heartbeat is the visual means to see that the written
program is still running or not. The indexed adressing is the one of the
software skills that examined in the lab 4. In addition , array data
structures, phase lock loop initialization, and usage of systick timer are the
other software skills that learned in the lab 4.
The index addressing was used in this lab for accessing the arrays
using pointers (datapt and timept). The databuffer array was used to
keep the situaion of the led(portE data) whether it is 1 or 0 and timebuffer
array was used to keep the value of the counter . To calculate the counter
value, the systick timer was used. In this lab system should work on the
80Mhz frequency . The phase lock loop initialization was used for
arranging the crystal to work on 80 Mhz frequency.
2.Procedure
First of all, the program code which was written at Lab2 was
modified for Lab3 requirements.At the software, the initialization part was
adjusted for port E. So, PE0 pin was configurated as input and and the
other pins were output. After that, the led situation was done as on. At the
loop label, the delay subroutine was defined as 62 ms approximately. The
clock cycles was calculated about 240000 and observed on the logic
analyzer. Then, according to switch situation, led will be on or toggle. The
program goes back to loop point and keep doing this permanently.
After the modification on the software,circuit drawed on PCBArtist
program. Then ,hardware circuit was set up and before connecting the
switch to the microcomputer ,.After that, the program code was loaded to
kit. Led status was observed for different switch positions. Some
measurements were performed for control the materials.
Flow Chart of the whole program and Pseudo Code of the system
3.Questions
3.1) Circuit diagram , using PCBArtist
3.2).The Screenshots
Switch is not pressed, led is on ;
While the switch is pressed and led is toggling, suddenly switch is not pressed
and led will be on;
Value
Resistance of the
10k resistor, R1
Units
Conditions
ohms
9.7 k
Supply Voltage,
V+3.3
volts
3.27
Input Voltage,
VPE0
Resistor current
volts
0.3
Calculated: 0.03
Measured: 0.01
Input Voltage,
VPE0
Resistor current
mA
volts
3.28
Calculated: 0.338
Measured: 0.307
mA
Value
Units
Conditions
Resistance of the
220 ohm resistor, R10
219
ohms
+5 V power supply
V+5
4.98
volts
1.7
volts
1.86
volts
3.5
volts
3.5-1.86=1.64
volts
LED current
Calculated: 6.7
Measured: 6.3
mA
3.28
volts
0.245
volts
2.17
volts
11
1.925
volts
12
LED current
Calculated: 12.0
Measured: 12.2
mA
4
5
9
10
with PE1 = 0
(measured with voltmeter)
with PE1 = 0
(measured with voltmeter)
with PE1 = 0
(measured with voltmeter)
calculated as Va+ - Vkcalculated as (V+5 - Va+)/R10
and
measured with an ammeter
with PE1 = 1
(measured with voltmeter)
with PE1 = 1
(measured with voltmeter)
with PE1 = 1
(measured with voltmeter)
calculated as Va+ - Vkcalculated as (V+5 - Va+)/R10
and
measured with an ammeter
4.Conclusion
In this lab , the lab3 software program was used with real time delay. The
real time clock estimation using the 24 bit counter is learned. The Crystal
arrangement of 80 Mhz is learned and examined in the pll_init subroutine .
Advanced index addressing and array data structures is learned well.
Hardware implementation;
5.) Appendix
;********************main.s******************
SYSCTL_RCGCGPIO_R
SYSCTL_SCGCGPIO_R
SYSCTL_DCGCGPIO_R
EQU
EQU
EQU
0x400FE608
0x400FE708
0x400FE808
GPIO_PORTE_DATA_R
GPIO_PORTE_DIR_R
GPIO_PORTE_AFSEL_R
GPIO_PORTE_PUR_R
GPIO_PORTE_DEN_R
GPIO_PORTE_AMSEL_R
GPIO_PORTE_PCTL_R
EQU
EQU
EQU
EQU
EQU
EQU
EQU
0x400243FC
0x40024400
0x40024420
0x40024510
0x4002451C
0x40024528
0x4002452C
AREA
THUMB
EXPORT
Start
Start
;
BL TExaS_Init ; voltmeter, scope on PD3
BL PortE_Init
; initialize input and output pins of Port E
MOV R0, #0x02
; R0 = 0x00000010 (PE1 LED on)
BL PortE_Output
; turn the green LED on
CPSIE I ;TExaS voltmeter, scope runs on interrupts loop
LDR
BL
BL
AND
CMP
R0, =ONEMSEC
delay
PortE_Input
R0, R0, #0x01
R0, #0x01
BNE led_on
led_toggle
BL
EOR
BL
B
PortE_Input
R0,R0,#0x02
PortE_Output
loop
led_on
MOV R0, #0x02
BL PortE_Output
B
loop
;------------delay-----------; Delay function for testing, which delays about 3*count cycles.
; Input: R0 count
; Output: none
ONESEC
EQU 9333333 ;approximately 1s delay at ~16 MHz clock
ONEMSEC
EQU 240000 ;approximately 1ms delay at ~16 MHz clock
QUARTERSEC
EQU 1333333 ;approximately 0.25s delay at ~16 MHz clock
delay
SUBS R0, R0, #1
; R0 = R0 - 1 (count = count - 1)
BNE delay
; if count (R0) != 0, skip to 'delay'
BX LR
; return
PortE_Init
LDR R1,
LDR R0,
ORR R0,
STR R0,
=SYSCTL_RCGCGPIO_R
[R1]
R0, #0x10
[R1]
NOP
NOP
LDR R1, =GPIO_PORTE_DIR_R
MOV R0,#0xfe
STR R0, [R1]
; configure as GPIO
; 0 means configure Port E as GPIO
; 5) enable Port E digital port
; 1 means enable digital I/O