EE 319K�Introduction to Microcontrollers
Lecture 1: Introduction, Architecture, Embedded Systems, ARM Programming, Introduction to I/O
Erez, Gerstlauer, Cuevas, Holt, Telang, Tiwari, Valvano, Yerraballi
Lab 1 and 2 are simulated, Lab 3 needs LaunchPad
1-1
Agenda
1-2
Lab kit
2, Green LED 1.7V 2mA 5mm
2, Red LED 1.8V 2mA 5mm
2, Yellow LED 1.9V 2mA 5mm
6, Carbon 1/4W resistor, 5%, 470,
5, Carbon 1/4W resistor, 5%, 1.5k,
3, Carbon 1/4W resistor, 5%, 12k,
4, Carbon 1/4W resistor, 5%, 10k,
1, Carbon 1/4W resistor, 5%, 24k,
1, 150-ohm speaker (needs soldering),
4, B3F tactile push button switch, B3F-1050,
1, Slide Potentiometer, Mouser 652-PTA20432015CPB10
Students buy
1) Wires and solderless breadboard
2) LaunchPad
3) Digital Multimeter
4) ST7735R Color LCD display
1-3
Useful Info
1-4
Action Items
1-5
DOs and DON’Ts
DO
DON’T
1-6
Embedded System
1-7
1-8
Job growth in IoT & Embedded Systems
Data science and analytics – 1027%
IT & Networking – 120%
Engineering & Architecture – 68%
Wearables – 68%
EE 445L – Bard, McDermott, Valvano
1-9
Microcontroller
1-10
ARM Cortex M4-based System
1-11
ARM ISA: Registers, Memory-map
TI TM4C123�Microcontroller
Condition Code Bit s Indicates
N negative Result is negative
Z zero Result is zero
V overflow Signed overflow
C carry Unsigned overflow
1-12
Cortex M
Registers
SP R13 is stack pointer
LR R14 is link register
PC R15 is program counter
Memory
Addresses are 32 bits
8-bit byte addressable
32-bit accesses 4 locations
1-13
Memory Access
Memory
AREA data,align=2
Stuff SPACE 4
Read from memory
LDR R0,=Stuff
LDR R1,[R0]
Write to memory
LDR R0,=Stuff
MOV R1,#5
STR R1,[R0]
1-14
Texas Instruments TM4C123 �
ARM Cortex-M4
+ 256K EEPROM�+ 32K RAM
+ JTAG
+ Ports
+ SysTick
+ ADC
+ UART
1-15
LaunchPad Switches and LEDs
1-16
I/O Ports and Control Registers
The input/output direction of a bidirectional port is specified by its direction register.
GPIO_PORTF_DIR_R , specify if corresponding pin is input or output:
GPIO_PORTF_DATA_R
GPIO_PORTF_DIR_R
1-17
I/O Ports and Control Registers
Address | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Name |
400F.E608 | - | - | GPIOF | GPIOE | GPIOD | GPIOC | GPIOB | GPIOA | SYSCTL_RCGCGPIO_R |
4002.53FC | - | - | - | DATA | DATA | DATA | DATA | DATA | GPIO_PORTF_DATA_R |
4002.5400 | - | - | - | DIR | DIR | DIR | DIR | DIR | GPIO_PORTF_DIR_R |
4002.551C | - | - | - | DEN | DEN | DEN | DEN | DEN | GPIO_PORTF_DEN_R |
Input: Read from GPIO_PORTF_DATA_R
Output: Write GPIO_PORTF_DATA_R
1-18
SW Development Environment
1-19
Toggle PF3
Start
LDR R0,=SYSCTL_RCGCGPIO_R
LDR R1,[R0]
ORR R1,#0x20 ;turn on clock F
STR R1,[R0]
NOP ;wait for clock to stabilize
NOP
LDR R0,=GPIO_PORTF_DIR_R
MOV R1,#0x08 ;PF3 output,
STR R1,[R0]
LDR R0,=GPIO_PORTF_DEN_R
MOV R1,#0x08 ;PF3 enable pin
STR R1,[R0]
loop
LDR R0,=GPIO_PORTF_DATA_R
LDR R1,[R0]
EOR R1,#0x08 ;toggle PF3 pin
STR R1,[R0]
LDR R2,=1000000
wait
SUBS R2,R2,#1
BNE wait
B loop
Run in InputOutput_4C123asm
1-20
Summary
1-21