看板Programming
標 題[問題]8X8 LED點矩陣
發信站I-Shou University BBS (Fri Jun 2 18:28:02 2006)
轉信站ptt!ctu-reader!ctu-gate!news.nctu!news.nsysu!news.isu!isu
能請各位大大幫忙嗎...
這是老師給我們的專題...0至9一直循環跑
原本是在8051書上找的範例...
但我們老師要我把我自己焊的版子接到ARM7的膜版上...
我是設PORTA當輸出,PORTB當計數而PORTB接上74HC244再接到8*8LED
我自己寫的ARM指令組語都跑不出來,都只有左邊4條在跑而且是不規則的在跑
以下是我寫的
equ PORTA_MUX, 0x09000000
equ PORTA_DATA, 0x09001600
equ PORTA_DIR, 0x09001604
equ PORTB_MUX, 0x09000004
equ PORTB_DIR, 0x0900160c
equ PORTB_DATA, 0x09001608
set DELAY_LED, 0xfffff
text
global _start
code 32
_start:
start:
ldr r0, =PORTB_DIR
mov r1, #0
str r1, [r0]
ldr r0, =PORTB_MUX
ldr r1, =0x00000faa
str r1, [r0]
ldr r0, =PORTB_DATA
mov r1, #0
str r1, [r0]
ldr r0, =PORTA_MUX
ldr r1, =0x3fff
str r1, [r0]
ldr r0, =PORTA_DIR
mov r1, #0
str r1, [r0]
k1:
ldr r0, =PORTA_DATA
mov r1, #0
str r1, [r0]
ldr r1,=0x00000000
k2:
ldr r0,=PORTB_DATA
str r1,[r0]
bl delay
add r1,r1,#1
cmp r1,#7
ble k2
k3:
ldr r0,=PORTB_DATA
str r1,[r0]
bl delay
t1: mov r5,#0
mov r8,#0
mov r2 , #0
t2: cmp r2, #200
beq t4
mov r1,#0
mov r4,#0
t3: ldr r0,=PORTB_DATA
adr r3,sel_table
ldr r3,[r3,+r1,lsl #2]
str r3,[r0]
ldr r0,=PORTA_DATA
adr r3,led_table
add r4,r4,r8
ldr r3,[r3,+r4,lsl #2]
str r3,[r0]
bl delay
cmp r1,#7
beq t2
add r1,r1,#1
add r4,r4,#1
add r2,r2,#1
b t3
t4: add r8,r8,#8
b t1
t5: ldr r0,=PORTA_DATA
mov r3,#0xff
str r3,[r0]
stop: b k1
.align 4
led_table:
word 0x000000ff,0x00000081,0x0000007e,0x0000007e,0x0000007e,0x00000081,0x00000
0ff,0x000000ff,
0x000000ff,0x000000ff,0x0000007d,0x00000000,0x0000007f,0x000000ff,0x00000
0ff,0x000000ff,
0x000000ff,0x000000ff,0x00000006,0x00000076,0x00000070,0x000000ff,0x00000
0ff,0x000000ff,
0x000000ff,0x000000ff,0x00000076,0x00000076,0x00000000,0x000000ff,0x00000
0ff,0x000000ff,
0x000000ff,0x000000ff,0x000000e0,0x000000ef,0x00000000,0x000000ef,0x00000
0ff,0x000000ff,
0x000000ff,0x000000ff,0x00000070,0x00000076,0x00000006,0x000000ff,0x00000
0ff,0x000000ff,
0x000000ff,0x000000ff,0x00000000,0x00000076,0x00000006,0x000000ff,0x00000
0ff,0x000000ff,
0x000000ff,0x000000ff,0x000000f8,0x000000fe,0x00000000,0x000000ff,0x00000
0ff,0x000000ff,
0x000000ff,0x000000ff,0x00000089,0x00000076,0x00000076,0x00000089,0x00000
0ff,0x000000ff,
0x000000ff,0x000000ff,0x00000070,0x00000076,0x00000000,0x000000ff,0x00000
0ff,0x000000ff,
sel_table:
word 0x00000000,0x00000001,0x00000002,0x00000003,0x00000004,0x00000005,0x000000
06,0x00000007
delay: ldr r0,=0xefff
delay1: subs r0, r0, #1
bne delay1
mov pc, lr
delaya: mov r0,#300
delay2: subs r0,r0,#1
bne delay2
mov pc,lr
.end
--
┌╗┬─ Origin:《Ψ義守觀山風情Ψ》<bbs.isu.edu.tw> ─┬╖╔╗
╚┘╙─ From : 義守大學宿舍區 ──────────╛└
╝╝