|
发表于 2009-9-13 16:54:36
|
显示全部楼层
前两天,老师要我做了个PIC32MX320F128H的最小系统,东西都焊好了。ICD2烧写正确,可灯只亮不闪,郁闷,延时时间已足够长,配置字设置正确。用逻辑笔测没有脉冲,软件仿真程序正确。各位,麻烦帮忙看看程序有什么问题。或者可能哪里有可能导致此问题。thanks
#include <p32xxxx.h>
#define IOPORT_BIT_7 (1 << 7)
.text
.set noreorder
/*********************************************************************
* main()
* This is where the PIC32 start-up code will jump to after initial
* set-up.
********************************************************************/
.ent main
main:
ori $a0,$zero,0
la $s0,TRISB
sw $a0,0($s0)
ori $a0,$zero,0x0ffff
la $s0,AD1PCFG
sw $a0,0($s0)
ori $a0,$zero,IOPORT_BIT_7
la $s0, LATBCLR
sw $a0, 0($s0)
here:
ori $a0,$zero,IOPORT_BIT_7
la $s0, LATBINV
sw $a0, 0($s0)
jal delay
nop
j here
nop
.end main
.ent delay
delay:
addiu $sp, $sp, -4
sw $s0, 0($sp)
li $t1,300000000
loop2:
li $t0,300000000
loop1:
addiu $t0,$t0,-1
bgtz $t0,loop1
NOP
addiu $t1,$t1,-1
bgtz $t1,loop2
nop
lw $s0,0(sp)
addiu $sp,$sp,4
jr $ra
nop
.end delay |
|