@;======================================================================
@; LED ON and OFF Program by taking input from sensor
@;
@; Modified by GAURAV
VERMA
@;
@;
@;======================================================================
AREA PROGRAM,
CODE, READONLY
ENTRY
PINSEL0 EQU 0xE002C000
PINSEL1 EQU 0xE002C004
IOPIN EQU 0xE0028000
IODIR EQU 0xE0028008
IOSET EQU 0xE0028004
IOCLR EQU 0xE002800C
ldr r1,=PINSEL0 ;
PINSEL0 controls pin 0-15
ldr r2,=0x00000000 ;default GPIO function 00
str r2, [r1]
ldr r1,=IODIR
ldr
r2,=0xFFFFFFFE ; 0-INPUT 1-OUTPUT
0:31
str r2, [r1]
BACK ldr r0,=IOSET
ldr r1,=0x7BFFFFFF ; SET ALL
str r1, [r0]
ldr r0,=IOPIN
key ldr
r3, [r0]
CMPS
r3, #0x03FFFFFF ; checking whether
switch is pressed or not
beq key
ldr r0,=IOCLR
ldr r2,=0x00000010 ; CLR p0.4
str r2, [r0]
BL WAIT
BAL
BACK
WAIT MOV
r4, #0x00100000
BACK1 nop
SUBS r4, r4, #1
bne BACK1
bx
R14
END
No comments:
Post a Comment