uvision3程序调试问题
uvision3中设计一个程序,调试时出现问题,希望能帮助解决!程序源代码:# include < reg51.h >
# define uchar unsigned char
# define uint unsigned int
uchar order1,order2;
uint t1,t2,t3,t4,t5,t6,t7,t8,t9,ta,tb,tc,td,te;
sbit D1 = P1^0;
sbit D3 = P1^1;
sbit D5 = P1^2;
sbit D7 = P1^3;
sbit D2 = P1^4;
sbit D4 = P1^5;
sbit D6 = P1^6;
sbit D8 = P1^7;
sbit D9 = P0^0;
sbit Da = P0^1;
sbit Db = P0^2;
sbit Dc = P0^3;
sbit Dd = P0^4;
sbit De = P0^5;
void timer0 ( void ) interrupt 1 using 1
{
switch ( order1 )
{
case 1 : {D1 = 1;TH0 = -t1/256;TL0 = -t1%256;} break;
case 2 : {D1 = 0;TH0 = -(2500-t1)/256;TL0 = -(2500-t1)%256;} break;
case 3 : {D2 = 1;TH0 = -t2/256;TL0 = -t2%256;} break;
case 4 : {D2 = 0;TH0 = -(2500-t2)/256;TL0 = -(2500-t2)%256;} break;
case 5 : {D3 = 1;TH0 = -t3/256;TL0 = -t3%256;} break;
case 6 : {D3 = 0;TH0 = -(2500-t3)/256;TL0 = -(2500-t3)%256;} break;
case 7 : {D4 = 1;TH0 = -t4/256;TL0 = -t4%256;} break;
case 8 : {D4 = 0;TH0 = -(2500-t4)/256;TL0 = -(2500-t4)%256;} break;
case 9 : {D5 = 1;TH0 = -t5/256;TL0 = -t5%256;} break;
case 10 : {D5 = 0;TH0 = -(2500-t5)/256;TL0 = -(2500-t5)%256;} break;
case 11 : {D6 = 1;TH0 = -t6/256;TL0 = -t6%256;} break;
case 12 : {D6 = 0;TH0 = -(2500-t6)/256;TL0 = -(2500-t6)%256;} break;
case 13 : {D7 = 1;TH0 = -t7/256;TL0 = -t7%256;} break;
case 14 : {D7 = 0;TH0 = -(2500-t7)/256;TL0 = -(2500-t7)%256;} break;
case 15 : {D8 = 1;TH0 = -t8/256;TL0 = -t8%256;} break;
case 16 : {D8 = 0;TH0 = -(2500-t8)/256;TL0 = -(2500-t8)%256;} break;
default : {order1 = 0;}
}
order1 ++;
}
void timer1 ( void ) interrupt 3 using 2
{
switch ( order2 )
{
case 1 : {D9 = 1;TH1 = -t9/256;TL0 = -t9%256;} break;
case 2 : {D9 = 0;TH1 = -(2500-t9)/256;TL0 = -(2500-t9)%256;} break;
case 3 : {Da = 1;TH1 = -ta/256;TL0 = -ta%256;} break;
case 4 : {Da = 0;TH1 = -(2500-ta)/256;TL0 = -(2500-ta)%256;} break;
case 5 : {Db = 1;TH1 = -tb/256;TL0 = -tb%256;} break;
case 6 : {Db = 0;TH1 = -(2500-tb)/256;TL0 = -(2500-tb)%256;} break;
case 7 : {Dc = 1;TH1 = -tc/256;TL0 = -tc%256;} break;
case 8 : {Dc = 0;TH1 = -(2500-tc)/256;TL0 = -(2500-tc)%256;} break;
case 9 : {Dd = 1;TH1 = -td/256;TL0 = -td%256;} break;
case 10 : {Dd = 0;TH1 = -(2500-td)/256;TL0 = -(2500-td)%256;} break;
case 11 : {De = 1;TH1 = -te/256;TL0 = -te%256;} break;
case 12 : {De = 0;TH1 = -(2500-te)/256;TL0 = -(2500-te)%256;} break;
default : {order2 = 0;}
}
order2 ++;
}
void delay ( uint delay1,uint delay2 )
{
uint a;uint b;
for ( a = 0;a < delay1;a ++ )
{
for ( b = 0;b < delay2;b ++ )
{}
}
}
void status ( void )
{
t1 = 1500;t2 = 1500;t3 = 1500;t4 = 1500;t5 = 1500;t6 = 1500;t7 = 1500;t8 = 1500;
t9 = 1500;ta = 1500;tb = 1500;tc = 1500;td = 1500;te = 1500;
delay ( 1000,200 );
}
void forword ( uint m )
{
uint i;
t1 = 1833;t2 = 1167;t7 = 1167;t8 = 1833;
delay ( 500,100 );
for ( i = 0;i < m;i ++ )
{
t1 = 1500;t2 = 1500;t7 = 1500;t8 = 1500;t5 = 1833;t6 = 1167;t3 = 1167;t4 = 1833;
delay ( 500,100 );
t5 = 1500;t6 = 1500;t3 = 1500;t4 = 1500;t1 = 1833;t2 = 1167;t7 = 1167;t8 = 1833;
delay ( 500,100 );
}
status ( );
}
void back ( uint n )
{
uint j;
t1 = 1833;t5 = 1167;t2 = 1167;t6 = 1833;t3 = 1833;t4 = 1167;t7 = 1167;t8 = 1833;
delay ( 500,100 );
t7 = 1500;t8 = 1500;t1 = 1500;t2 = 1500;
delay ( 500,100 );
for ( j = 0;j < n;j ++ )
{
t7 = 1167;t8 = 1833;t1 = 1833;t2 = 1167;t3 = 1500;t4 = 1500;t5 = 1500;t6 = 1500;
delay ( 500,100 );
t4 = 1167;t3 = 1833;t6 = 1833;t5 = 1167;t7 = 1500;t8 = 1500;t1 = 1500;t2 = 1500;
delay ( 500,100 );
}
status ( );
}
void footup ( uint o )
{
uint k;
for ( k = 0;k < o;k ++ )
{
t2 = 1833;delay ( 500,100 );
t2 = 2166;delay ( 500,100 );
t2 = 1833;delay ( 500,100 );
t2 = 1500;delay ( 500,100 );
t2 = 1167;delay ( 500,100 );
t2 = 834;delay ( 500,100 );
t2 = 1167;delay ( 500,100 );
t2 = 1500;delay ( 500,100 );
t8 = 1833;delay ( 500,100 );
t8 = 2166;delay ( 500,100 );
t8 = 1833;delay ( 500,100 );
t8 = 1500;delay ( 500,100 );
t8 = 1167;delay ( 500,100 );
t8 = 834;delay ( 500,100 );
t8 = 1167;delay ( 500,100 );
t8 = 1500;delay ( 500,100 );
}
status ( );
}
void down ( uint p )
{
uint l;
for ( l = 0;l < p;l ++ )
{
t4 = 1833;t8 = 1167;t1 = 1833;t5 = 1167;
delay ( 500,100 );
t4 = 1500;t8 = 1500;t1 = 1500;t5 = 1500;
delay ( 500,100 );
}
status ( );
}
void left ( uint q )
{
uint r;
for ( r = 0;r < q;r ++ )
{
t9 = 1167;tb = 1167;delay ( 500,100 );
ta = 1167;tc = 1167;delay ( 500,100 );
forword ( 3 );
}
}
void right ( uint s )
{
uint u;
for ( u = 0;u < s;u ++ )
{
tb = 1833;t9 = 1833;delay ( 500,100 );
ta = 1833;tc = 1833;delay ( 500,100 );
forword ( 3 );
}
}
void shake_had ( uint v )
{
uint w;
for ( w = 0;w < v;w ++ )
{
td = 1833;delay ( 500,100 );
td = 1500;delay ( 500,100 );
td = 1167;delay ( 500,100 );
td = 1500;delay ( 500,100 );
}
status ( );
}
void shake_weiba ( uint y )
{
uint z;
for ( z = 0;z < y;z ++ )
{
te = 1833;delay ( 500,100 );
te = 1500;delay ( 500,100 );
te = 1167;delay ( 500,100 );
te = 1500;delay ( 500,100 );
}
status ( );
}
void main ( void )
{
TMOD = 0X11;
order1 = 1;order2 = 1;
TH0 = -1500/256;TL0 = -1500%256;
TH1 = -1500/256;TL1 = -1500%256;
EA = 1;
ET0 = 1;TR0 = 1;PT0 = 1;
ET1 = 1;TR1 = 1;PT1 = 1;
status ( );
shake_had ( 3 );
shake_weiba ( 3 );
forword ( 10 );
back ( 10 );
footup (10);
left ( 10 );
right ( 10 );
down ( 5 );
}
编译成功,但使用全速调试后显示:error:access violation at 0x00A0:no execute or read 。。。
怎么解决?还有,怎么生成hex文件?有谁知道,给小弟说一声!