Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .include "inter.s"
- .text
- inicio:
- /* CODIGO */
- ldr r4, =GPBASE @ base
- /* guia bits xx999888777666555444333222111000 */
- mov r5, #0b00001000000000000000000000000000 @ set gpio9
- str r5, [r4, #GPFSEL0] @ Configure GPIO9
- /* guia bits 10987654321098765432109876543210 */
- mov r5, #0b00000000000000000000001000000000 @ sel gpio9
- ldr r0, =STBASE @ r0 is an input parameter (ST base address)
- ldr r1, =1000000 @ r1 is an input parameter (waiting time in microseconds)
- bucle:
- str r5, [r4, #GPSET0] @ Turn LED on
- bl espera @ Call waiting routine
- str r5, [r4, #GPCLR0] @ Turn LED off
- b bucle
- espera:
- push {r4, r5} @ Save r4 and r5 in the stack
- ldr r4, [r0, #STCLO] @ Load CLO timer
- add r4, r1 @ Add waiting time -> this is our ending time
- ret1:
- ldr r5, [r0, #STCLO] @ Enter waiting loop: load current CLO timer
- cmp r5, r4 @ Compare current time with ending time
- blo ret1 @ If lower, go back to read timer again
- /*estoy haciendo esto para ver si se apaga pero no hay manera,incluso renombrando r4 y r5 a como deberian ser para apagar*/
- ldr r4, =GPBASE
- mov r5, #0b00000000000000000000001000000000
- str r5, [r4, #GPCLR0] @ Turn LED off
- pop {r4, r5} @ Restore r4 and r5
- bx lr @ Return from routine
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement