0
我想讀取GPIO引腳的電平。在文檔中發現的芯片以下:讀取GPIO的引腳電平?
GPIO Pin Level Registers (GPLEVn)
SYNOPSIS The pin level registers return the actual value of the pin.
The LEV{n} field gives the value of the respective GPIO pin.
Bit(s) Field Name Description Type Reset
21-0 LEVn (n=32..53) 0 = GPIO pin n is low R/W 0
1 = GPIO pin n is high
這是我寫的代碼:
ldr r0,=0x20200038 @ Load address of GPLEV into r0
mov r1,#1 @ Load value 1 into r1
lsl r1,#18 @ Left shift value in r1 eighteen places. This corresponds to GPIO50
str r1,[r0] @ Store the content of r1 at the address in r0
我現在希望找到在R0引腳的電平,但它確實似乎沒有工作。上述代碼是讀取GPIO引腳電平的正確方法嗎?
可能是他想掩飾他想要的針。 – auselen