Skip to content

Commit 631ca6b

Browse files
jenniferlin0902CS107E Bot
jenniferlin0902
authored and
CS107E Bot
committed
release lab1
commit 476d939c2a616d82d1255e19d4432fc0ee19bbc0 Author: jenniferlin0902 <[email protected]> Date: Mon Jan 14 09:20:09 2019 -0800 release lab1
1 parent f51ff71 commit 631ca6b

12 files changed

+736
-1
lines changed

_data/unreleased.csv

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
permalink,title,released
22
"/labs/lab4/","Lab 4: Linked and Loaded",false
3-
"/labs/lab1/","Lab 1: Setup your Raspberry Pi",false
43
"/labs/lab5/","Lab 5: Keyboard Surfin",false
54
"/labs/projectlab1/","Project Lab 1: What is Your Project?",false
65
"/labs/lab3/","Lab 3: Debugging and Testing",false

labs/lab1/README.md

+625
Large diffs are not rendered by default.

labs/lab1/checkin.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
permalink: /labs/lab1/checkin/
3+
title: 'Lab 1: Check-in'
4+
---
5+
6+
1. How much current flows through the LED?
7+
8+
2. What is the offset in bytes where e3 occurs in blink.bin?
9+
10+
3. Show us that you are able to use bootloader to send a program to the Pi. Your success confirms you are ready for action -- way to go!
11+
12+
4. How can you use the blink program to experimentally estimate the number of instructions per second executed by the ARM processor in the Raspberry Pi?
13+
14+
Don't forget to return all tools to the shelves & leave your workspace as clean as you left it.

labs/lab1/code/blink/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Blink an LED
2+
3+
Blink the LED connected to GPIO 20.
4+
5+

labs/lab1/code/blink/blink.s

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.equ DELAY, 0x3F0000
2+
3+
// configure GPIO 20 for output
4+
ldr r0, FSEL2
5+
mov r1, #1
6+
str r1, [r0]
7+
8+
// set bit 20
9+
mov r1, #(1<<20)
10+
11+
loop:
12+
13+
// set GPIO 20 high
14+
ldr r0, SET0
15+
str r1, [r0]
16+
17+
// delay
18+
mov r2, #DELAY
19+
wait1:
20+
subs r2, #1
21+
bne wait1
22+
23+
// set GPIO 20 low
24+
ldr r0, CLR0
25+
str r1, [r0]
26+
27+
// delay
28+
mov r2, #DELAY
29+
wait2:
30+
subs r2, #1
31+
bne wait2
32+
33+
b loop
34+
35+
FSEL0: .word 0x20200000
36+
FSEL1: .word 0x20200004
37+
FSEL2: .word 0x20200008
38+
SET0: .word 0x2020001C
39+
SET1: .word 0x20200020
40+
CLR0: .word 0x20200028
41+
CLR1: .word 0x2020002C
42+

labs/lab1/code/button/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Use a button to control an LED.
2+
3+
The button is connected to GPIO 10.
4+
5+
The LED is connected to GPIO 20.
6+

labs/lab1/code/button/button.s

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// configure GPIO 10 for input
2+
ldr r0, FSEL1
3+
mov r1, #0
4+
str r1, [r0]
5+
6+
// configure GPIO 20 for output
7+
ldr r0, FSEL2
8+
mov r1, #1
9+
str r1, [r0]
10+
11+
// bit 10
12+
mov r2, #(1<<10)
13+
14+
// bit 20
15+
mov r3, #(1<<20)
16+
17+
loop:
18+
// read GPIO 10
19+
ldr r0, LEV0
20+
ldr r1, [r0]
21+
tst r1, r2
22+
beq on // when the button is pressed (goes LOW), turn on LED
23+
24+
// set GPIO 20 low
25+
off:
26+
ldr r0, CLR0
27+
str r3, [r0]
28+
b loop
29+
30+
// set GPIO 20 high
31+
on:
32+
ldr r0, SET0
33+
str r3, [r0]
34+
b loop
35+
36+
FSEL0: .word 0x20200000
37+
FSEL1: .word 0x20200004
38+
FSEL2: .word 0x20200008
39+
SET0: .word 0x2020001C
40+
SET1: .word 0x20200020
41+
CLR0: .word 0x20200028
42+
CLR1: .word 0x2020002C
43+
LEV0: .word 0x20200034
44+
LEV1: .word 0x20200038

labs/lab1/images/led.jpg

1.28 MB
Loading

labs/lab1/images/pi_pinout.jpg

42.7 KB
Loading

labs/lab1/images/piled.gpio20.jpg

1.23 MB
Loading

labs/lab1/images/piled.jpg

1.58 MB
Loading

labs/lab1/images/tools.jpg

342 KB
Loading

0 commit comments

Comments
 (0)