Advertisement
Guest User

Full Test

a guest
Dec 19th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ARM 0.86 KB | None | 0 0
  1. /* This program turn on all leds. After pressing button 1, three leds
  2. will turn off, and while the button 2 is pressed a sound is made*/
  3.  
  4. .include "configuration.inc"
  5.     ldr  r0, =0x3F20001C    /*r0 contents the port address for ON */
  6.     ldr  r2, =0x3F200028    /*r0 contents the port address for ON */
  7.     ldr  r3, =0x3F200034    /*r0 contents the port address for ON */
  8.     ldr  r1, =0x08420E00       
  9.     str  r1,[r0]
  10. loop:
  11.     ldr  r8,[r3]
  12.     tst r8, #0b00100
  13.     ldr  r1, =0x00E00      
  14.     streq  r1,[r2]
  15.     tst r8, #0b001000
  16.     bleq  sonido
  17.     b loop
  18. sonido:
  19.     ldr r1, =0x010 /* r1= 0x20= 00… 0001 0000 ? bit4=1*/
  20.     str r1,[r0] /* HIGH */
  21.     BL wait /* Routine for waiting 200 ms. */
  22.     ldr r1, =0x010 /* r1= 0x20= 00… 0001 0000 ? bit4=1*/
  23.     str r1,[r2] /* LOW */
  24.     BL wait /* Routine for waiting 200 ms. */
  25.     B loop
  26. wait:
  27.         ldr r5, =700
  28. loop2:  subs r5, #1
  29.         bne loop2
  30.         bx lr
  31. END:    B END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement