C 程序烧写后不运行 有没有人指点一下啊
时间:10-02
整理:3721RD
点击:
为什么我用C语言编写的数码显示程序用TOP编程器下载到AT89C52中运行不了啊。但是proteus仿真是可以的,其中中断子程序里让P1.0口输出方波也可以实现,但是主程序里的8155显示就是显示不了。或者偶尔显示出来了,复位以后就没了,但是方波一直还在。有人说是烧写过程中主程序占用的中断入口地址,可是C语言里没见过类似汇编里的 ORG 0000H
AJMP MAIN
ORG 0100H
MAIN:
这些类似的语句啊。
在C语言里该怎么办啊,图和程序如下:#include<reg52.h>#include"absacc.h"
#define uchar unsigned char
#define uint unsigned int
#define BASE 0x5F00
#define wei_A (BASE+1)
#define duan_B (BASE+2)
sbit P1_0=P1^0;
uchar code select[]={0x20,0x10,0x08,0x04,0x02,0x01};
uchar code LED_CODES[]={0xc0,0xf9,0xa4,0xb0,0x99, /*0~4*/
0x92,0x82,0xf8,0x80,0x90, /*5~9*/
0x88,0x83,0xc6,0xa1,0x86, /*A,B,C,D,E*/
0x8e,0xff,0x0c,0x89,0x7f,0xbf}; /*F,空格,P,H,.,- 共阳极*/
void display(uchar,uchar,uchar,uchar,uchar,uchar);
void delay(uint z);
void main()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
XBYTE[BASE]=0x03;
while(1)
{
display(8,9,0,7,1,2);
}
}
void display(uchar aa,uchar bb,uchar cc,uchar bai,uchar shi,uchar ge)
{
XBYTE[wei_A]=select[0];
XBYTE[duan_B]=LED_CODES[aa];
delay(10);
XBYTE[wei_A]=select[1];
XBYTE[duan_B]=LED_CODES[bb];
delay(10);
XBYTE[wei_A]=select[2];
XBYTE[duan_B]=LED_CODES[cc];
delay(10);
XBYTE[wei_A]=select[3];
XBYTE[duan_B]=LED_CODES[bai];
delay(10);
XBYTE[wei_A]=select[4];
XBYTE[duan_B]=LED_CODES[shi];
delay(10);
XBYTE[wei_A]=select[5];
XBYTE[duan_B]=LED_CODES[ge];
delay(10);
}
void delay(uint z)
{
uint t,y;
for(t=z;t>0;t--)
for(y=100;y>0;y--);
}
void T0_INT()interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
P1_0=~P1_0;
}
希望大家帮帮忙啊,我等着放暑假呢~谢谢啦!
AJMP MAIN
ORG 0100H
MAIN:
这些类似的语句啊。
在C语言里该怎么办啊,图和程序如下:#include<reg52.h>#include"absacc.h"
#define uchar unsigned char
#define uint unsigned int
#define BASE 0x5F00
#define wei_A (BASE+1)
#define duan_B (BASE+2)
sbit P1_0=P1^0;
uchar code select[]={0x20,0x10,0x08,0x04,0x02,0x01};
uchar code LED_CODES[]={0xc0,0xf9,0xa4,0xb0,0x99, /*0~4*/
0x92,0x82,0xf8,0x80,0x90, /*5~9*/
0x88,0x83,0xc6,0xa1,0x86, /*A,B,C,D,E*/
0x8e,0xff,0x0c,0x89,0x7f,0xbf}; /*F,空格,P,H,.,- 共阳极*/
void display(uchar,uchar,uchar,uchar,uchar,uchar);
void delay(uint z);
void main()
{
TMOD=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
EA=1;
ET0=1;
TR0=1;
XBYTE[BASE]=0x03;
while(1)
{
display(8,9,0,7,1,2);
}
}
void display(uchar aa,uchar bb,uchar cc,uchar bai,uchar shi,uchar ge)
{
XBYTE[wei_A]=select[0];
XBYTE[duan_B]=LED_CODES[aa];
delay(10);
XBYTE[wei_A]=select[1];
XBYTE[duan_B]=LED_CODES[bb];
delay(10);
XBYTE[wei_A]=select[2];
XBYTE[duan_B]=LED_CODES[cc];
delay(10);
XBYTE[wei_A]=select[3];
XBYTE[duan_B]=LED_CODES[bai];
delay(10);
XBYTE[wei_A]=select[4];
XBYTE[duan_B]=LED_CODES[shi];
delay(10);
XBYTE[wei_A]=select[5];
XBYTE[duan_B]=LED_CODES[ge];
delay(10);
}
void delay(uint z)
{
uint t,y;
for(t=z;t>0;t--)
for(y=100;y>0;y--);
}
void T0_INT()interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
P1_0=~P1_0;
}
希望大家帮帮忙啊,我等着放暑假呢~谢谢啦!