刚刚开始用F166A,写好的工程无**常仿真,怀疑是程序的问题,就借鉴了论坛上一位朋友的程序;#include<SH79F166A.h>
#define uint unsigned int
#define uchar unsigned char
void delay(uint x);
sbit LED0=P0
^2;
sbit LED1=P0
^4;
sbit LED2=P0
^6;
sbit LED3=P2
^0;
sbit LED4=P4
^0;
sbit LED5=P3
^6;
void main()
{ P0CR=0x54;
P2CR=0x01;
P3CR=0x40;
P4CR=0x01;
P0PCR=0x54;
P2PCR=0x01;
P3PCR=0x40;
P4PCR=0x01;
P0SS=0;
P2SS=0;
P3SS=0;
LED0=1;
LED1=1;
LED2=1;
LED3=1;
LED4=1;
LED5=1;
while(1);
}
硬件仿真,显示运行,无法进入主chengxu
译以后 129:
130: STARTUP1:
131:
132: IF IDATALEN <> 0
C:0x0000 02009C LJMP C:009C
17: void main()
18: { P0CR=0x54;
C:0x0003 02008A LJMP C:008A
19: P2CR=0x01;
C:0x0006 75E1FF MOV P0CR(0xE1),#0xFF
20: P3CR=0x40;
C:0x0009 75E9FF MOV P0PCR(0xE9),#0xFF
21: P4CR=0x01;
C:0x000C 75E2FF MOV 0xE2,#0xFF
22: P0PCR=0x54;
C:0x000F 75EAFF MOV 0xEA,#0xFF
23: P2PCR=0x01;
C:0x0012 75E3FF MOV P2CR(0xE3),#0xFF
24: P3PCR=0x40;
C:0x0015 75EBFF MOV P2PCR(0xEB),#0xFF
25: P4PCR=0x01;
C:0x0018 75E4FF MOV P3CR(0xE4),#0xFF
26: P0SS=0;
C:0x001B 75ECFF MOV P3PCR(0xEC),#0xFF
27: P2SS=0;
问题在于C:0x0000 02009C LJMP C:009C,此条跳转到位置不对,不能进入主程序,请大家帮忙看看是什么原因,谢谢 |