2

I have 2 leds and one button. both green and yellow led off when booting from card. When the button is pressed, i want to turn green led off and yellow led on.

However, I have to write assembly. I don't understand setting input and reading from pin.

  mov r1,#0
lsl r1,#6
str r1,[r0,#8]

I set gpio as input wtih first and last line ; mov r1,#0 and str r1,[r0,#8]

however:

  1. I'm not sure about the second line, lsl r1,**#6**" for gpio22
  2. Condition check function:

    ldr r2, =0x20200036 ldr r0, =0x20200000 ldrb r1,[r2] cmp r1, #64 beq sari$

I want to if this function return true goto sari$ loop.

2
  • This is all explained in the Broadcom BCM2835 ARM Peripherals manual from page 89. The only thing to note is that register addresses shown as 0x 7E20 XXXX in that document are at physical address 0x 2020 XXXX. You need to understand that documentation if you want to manipulate the gpios at this level.
    – joan
    Commented Nov 30, 2014 at 10:01
  • yes, I write this value from manual however, these codes not running. I think the codes can't read 22th pin. So, I'm not sure value and code.
    – Orcun
    Commented Nov 30, 2014 at 16:20

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.