Document directory
- Basic Principles:
- Logical operation commands:
-
- Comparison command:
Basic Principles:
Logical operation commands:
And r0, R0, #0x01; R0 = R0 & 0x01 retrieve R0's percentile data
ORR r0, R0, # 0xff; R0 = R0 | 0xff
LSR logical shift right logic right shift
RX, LSR # N or RX, LSR, Rn
Register = register> shift
EOR logical exclusive or
EOR r0, R0, #3 reverse r0, 0 and 1 in
Bic (bit clear)
Bic r0, # % 0110; note that the binary format is %
Comparison command:
CMP R1, #10 compare and set CPSR
Tst
TEQ
Condition judgment mark:
Register address R/W description reset value
Gpfcon 0x56000050 R/W configures the pins of port F 0x0
Gpfdat 0x56000054 R/W the data register for port f undef.
Gpfup 0x56000058 R/W pull-up disable register for port F 0x000
Reserved 0x5620.5c ---
00 = input 01 = Output
1) set gpf0/2/3/4 to input
00 00 00 01 00
Area button, code, readonly
Entry
Start
Prohibit pull-up Resistance
LDR R1, = 0x56000058
LDR R2, = 0xff
STR R2, [R1]
; Set GPF0--GPF4 as input
LDR R3, = 0x56000050
LDR R4, = 0x55555404
STR R4, [R3]
; Set the corresponding port of the buzzer to the output
LDR R1, = 0x56000010
LDR R2, = 0x01
STR R2, [R1]
Loop
; Read data
LDR R3, = 0x56000054
LDR R4, [R3]; read data
; Determines whether a key is pressed
11100010
; Will be unique in the key-independent position 1
ORR R4, R4, #0xe2
CMP R4, # 0xff
Beq beep_down
B beep_on
B Loop
; Close the buzzer
Beep_down
LDR R1, = 0x56000014
LDR R2, = 0x0
STR R2, [R1]
B Loop
Beep_on
LDR R1, = 0x56000014
LDR R2, = 0x1
STR R2, [R1]
B Loop
End
---------------------------------------------------------------------- Persistently strives for Excellence ------------------------------------------------------------------------------