Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. .include "inter.s"
  2.  
  3. .text
  4. inicio:
  5.  
  6. /* CODIGO */
  7. ldr r4, =GPBASE @ base
  8. /* guia bits xx999888777666555444333222111000 */
  9. mov r5, #0b00001000000000000000000000000000 @ set gpio9
  10. str r5, [r4, #GPFSEL0] @ Configure GPIO9
  11. /* guia bits 10987654321098765432109876543210 */
  12. mov r5, #0b00000000000000000000001000000000 @ sel gpio9
  13. ldr r0, =STBASE @ r0 is an input parameter (ST base address)
  14. ldr r1, =1000000 @ r1 is an input parameter (waiting time in microseconds)
  15. bucle:
  16. str r5, [r4, #GPSET0] @ Turn LED on
  17. bl espera @ Call waiting routine
  18. str r5, [r4, #GPCLR0] @ Turn LED off
  19. b bucle
  20. espera:
  21. push {r4, r5} @ Save r4 and r5 in the stack
  22. ldr r4, [r0, #STCLO] @ Load CLO timer
  23. add r4, r1 @ Add waiting time -> this is our ending time
  24. ret1:
  25. ldr r5, [r0, #STCLO] @ Enter waiting loop: load current CLO timer
  26. cmp r5, r4 @ Compare current time with ending time
  27. blo ret1 @ If lower, go back to read timer again
  28.  
  29. /*estoy haciendo esto para ver si se apaga pero no hay manera,incluso renombrando r4 y r5 a como deberian ser para apagar*/
  30. ldr r4, =GPBASE
  31. mov r5, #0b00000000000000000000001000000000
  32. str r5, [r4, #GPCLR0] @ Turn LED off
  33.  
  34. pop {r4, r5} @ Restore r4 and r5
  35. bx lr @ Return from routine
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement