Beruflich Dokumente
Kultur Dokumente
DEPARTMENT OF
ELECTRICAL AND ELECTRONICS ENGINEERING
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. Also the systick timer was used for
estimation of real time clock. 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
In the lab session, firstly, the our arrays that are DataBuffer and TimeBuffer were
defined and allocated. Also DataPt and TimePt pointers were defined. After that, port E ,port
F and Debug part were initialized. By the way, the bus speed was arranged to 80 Mhz using
the PLL. In the Debug_Init part, DataBuffer and TimeBuffer arrays that has 50 size of index
were initialized by moving 0xFFFFFFFF into these arrays. Then, pointers were adjusted to
the base addresses.
Secondly, the led that is second bit of port E is adjusted as on. Below the led_on label,
this led is changed according to switch is on or off. If switch is on, led will be toggle. In
addition, there is another led to the third pin of port F. This is toggling during the execution
time.
Final part of code is debug_capture part. That part is used for saving led situation and
time on the DataBuffer array and TimeBuffer array, respectively. Also, there are some
shifting operation as shown on the laboratory paper.
2.2).The Screenshots
3.) 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.
4.) Appendix
SWITCH
LED
SYSCTL_RCGCGPIO_R
EQU 0x400FE608
SYSCTL_RCGC2_GPIOE
SYSCTL_RCGC2_GPIOF
SYSCTL_RCC2_R
EQU 0x400FE070
SYSCTL_RCC_R
EQU 0x400FE060
SYSCTL_RIS_R
EQU 0x400FE050
GPIO_PORTE_DATA_R
GPIO_PORTE_DIR_R
GPIO_PORTE_AFSEL_R
EQU 0x400243FC
EQU 0x40024400
EQU 0x40024420
GPIO_PORTE_DEN_R
EQU 0x4002451C
GPIO_PORTE_PCTL_R
EQU 0x4002452C
GPIO_PORTE_AMSEL_R
EQU 0x40024528
NVIC_ST_CURRENT_R
EQU 0xE000E018
NVIC_ST_RELOAD_R
EQU 0xE000E014
NVIC_ST_CTRL_R
EQU 0xE000E010
GPIO_PORTF_DATA_R
GPIO_PORTF_DIR_R
EQU 0x400253FC
EQU 0x40025400
GPIO_PORTF_AFSEL_R
EQU 0x40025420
GPIO_PORTF_DEN_R
EQU 0x4002551C
GPIO_PORTF_AMSEL_R
EQU 0x40025528
GPIO_PORTF_PCTL_R
EQU 0x4002552C
GPIO_PORTF_PUR_R
EQU
AREA
SIZE
EQU
0x40025510
DATA, ALIGN=2
50
SPACE 4
TimePt
SPACE 4
EXPORT TimePt
ALIGN
AREA
THUMB
EXPORT Start
IMPORT TExaS_Init
IMPORT SysTick_Init
IMPORT SysTick_Wait
IMPORT SysTick_Wait10ms
IMPORT PLL_Init
BL Port_Ini
BL Debug_Init
BL PLL_Init
; led on
LDR R0,=ONEMSEC
loop
BL
delay
BL
heartbeat
BL
Debug_Capture
Buton
LDR R6, = GPIO_PORTE_DATA_R
LDR R7,[R6]
AND R7,R7,#1
CMP R7,#0
BEQ led_on
LDR R6, = GPIO_PORTE_DATA_R
LDR R8,[R6]
AND R8,R8,#0x02
EOR R8,R8,#0x02
STR
R8,[R6]
loop
heartbeat
LDR R1,
AND R0,R0,#0x04
EOR R0,R0,#0x04
STR
R0,[R1]
BX
LR
; 60 ms delay
delay
LDR R0,=240000
dela
SUBS R0,R0,#1
BNE dela
BX LR
; R1 = &SYSCTL_RCGCGPIO_R
; R0 = [R1]
; Port F
; [R1] = R0
NOP
NOP
; R0 = [R1]
; R0 = R0|0x04 (make PF2 output; PF2 built-in blue
LED)
STR R0, [R1]
; R1 = &GPIO_PORTF_DIR_R
; [R1] = R0
; R1 = &GPIO_PORTF_DEN_R
; R0 = [R1]
; R0 = R0|0x04 (enable digital I/O on PF)
; [R1] = R0
; configure as GPIO
LDR R1, =GPIO_PORTF_PCTL_R
MOV R0, #0
; configure as GPIO
; 0 means configure Port E as GPIO
;PortE Init
LDR R1, =SYSCTL_RCGCGPIO_R
LDR R0, [R1]
NOP
NOP
; configure as GPIO
MOV R0, #0
LR
;------------Debug_Init------------
Debug_Init
BX LR
Debug_Capture
MOV R11,#0
SUB R10,R10,#1
CMP R10,R11
BEQ ppp
LDR R0,=DataPt
LDR R2,[R0]
LDR R1,=TimePt
LDR R3,[R1]
STR R6,[R3]
timebuffer using timept pointer
ADD R3,R3,#4
MOV R9,#0
ADD R8,R0,#0
in the r8
AND R0,R0,#0x02
LSR
R0,R0,#1
STR R0,[R9]
;store it into R9
ADD R0,R8,#0
AND R0,R0,#0x01
LSL R0,R0,#4
ADD R0,R0,R9
;R0 = R0 + R9
STR R0,[R2]
using datapt pointer
ADD R2,R2,#4
BX LR
ppp
ALIGN
END