Question
need help to build a assembly code into the equipment, breadboard, TM4C123 controller, TACTLE switch, resistor and LED. how to build the breadboard. I just
need help to build a assembly code into the equipment, breadboard, TM4C123 controller, TACTLE switch, resistor and LED. how to build the breadboard. I just want to ask which code is which position. thanks
here is code
The overall objective of this system is a digital lock ; Hardware connections ; PF4 is switch input (1 means SW1 is not pressed, 0 means SW1 is pressed) ; PF2 is LED output (1 activates blue LED) ; The specific operation of this system ; 1) Make PF2 an output and make PF4 an input (enable PUR for PF4). ; 2) The system starts with the LED ON (make PF2 =1). ; 3) Delay for about 1 ms ; 4) If the switch is pressed (PF4 is 0), then toggle the LED once, else turn the LED ON. ; 5) Repeat steps 3 and 4 over and over
GPIO_PORTF_DATA_R EQU 0x400253FC GPIO_PORTF_DIR_R EQU 0x40025400 GPIO_PORTF_AFSEL_R EQU 0x40025420 GPIO_PORTF_PUR_R EQU 0x40025510 GPIO_PORTF_DEN_R EQU 0x4002551C GPIO_PORTF_AMSEL_R EQU 0x40025528 GPIO_PORTF_PCTL_R EQU 0x4002552C SYSCTL_RCGCGPIO_R EQU 0x400FE608
THUMB AREA DATA, ALIGN=2 ;global variables go here ALIGN AREA |.text|, CODE, READONLY, ALIGN=2 EXPORT Start INIT ; 1) activate clock for Port F LDR R1, =SYSCTL_RCGCGPIO_R LDR R0, [R1] ; R0 = [R1] ORR R0, R0, #0x20 ; R0 = R0|0x08 STR R0, [R1] ; [R1] = R0 NOP NOP NOP NOP ; allow time to finish activating ; 3) set direction register LDR R1, =GPIO_PORTF_DIR_R ; R1 = &GPIO_PORTF_DIR_R LDR R0, [R1] ; R0 = [R1] ORR R0, R0, #0x04 ; R0 = R0|0x08 (make PF2 output) BIC R0, R0, #0x10 ; R0 = R0 & NOT(0x10) (make PF4 input) STR R0, [R1] ; [R1] = R0 ; 4) regular port function LDR R1, =GPIO_PORTF_AFSEL_R ; R1 = &GPIO_PORTF_AFSEL_R LDR R0, [R1] ; R0 = [R1] BIC R0, R0, #0x14 ; R0 = R0&~0x09 (disable alt funct on PF4,PF2) STR R0, [R1] ; [R1] = R0 ; 5) enable digital port LDR R1, =GPIO_PORTF_DEN_R ; R1 = &GPIO_PORTF_DEN_R LDR R0, [R1] ; R0 = [R1] ORR R0, R0, #0x14 ; R0 = R0|0x09 (enable digital I/O on PF4,PF2) STR R0, [R1] ; [R1] = R0 ; 6) enable PUR port LDR R1, =GPIO_PORTF_PUR_R ; R1 = &GPIO_PORTF_DEN_R LDR R0, [R1] ; R0 = [R1] ORR R0, R0, #0x04 ; R0 = R0|0x09 (enable digital I/O on PF4) STR R0, [R1] ; [R1] = R0
BX LR Start BL INIT LDR R0, =GPIO_PORTF_DATA_R LDR R1, [R0] ORR R1, R1, #0x04 STR R1, [R0] loop
; BL delay ; delay
LDR R1, [R0] AND R2, R1, #0x10 CMP R2, #0x10 BEQ tON EOR R1, R1, #0x04 B exit tON ORR R1, R1, #0x04 exit STR R1, [R0] B loop
delay MOV R4, #800 wait SUB R4, R4, #01 CMP R4, #0 BNE wait BX LR ALIGN ; make sure the end of this section is aligned END ; end of file
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started