问题遇到的现象和发生背景
为什么用下列代码烧录进单片机,结果单片机上无法显示
代码如下
//¹¤×÷ƵÂÊΪ12MHz
#include "stc15w4k32s4.h"
#include "intrins.h"
#include "lcd1602.h"
unsigned long c=0;
//*********************************************************
//º¯ÊýÃû³Æ:Cx interrupt 7
//º¯Êý¹¦ÄÜ:ÇóµçÈÝ
//Èë¿Ú²ÎÊý:ÎÞ
//³ö¿Ú²ÎÊý:c
//*********************************************************
void Cx() interrupt 7
{
CL=0; //Çå¼ÆÊýÆ÷
CH=0;
CR=1; //Æô¶¯PCA¼ÆʱÆ÷
CCF0=0;
while(~CCF0); //µÈ´ý½áÊøϽµÑص½´ï
CCF0=0;
CR=0; //Í£Ö¹PCA¼ÆʱÆ÷
c=(CCAP0H<<8)+CCAP0L; //»ñÈ¡ÖÜÆÚ
c=3405*c/10000; //»ñÈ¡µçÈÝÖµ
}
/******************************²âÂö³åÖÜÆÚ***************************
P11½ÓÊäÈëÐźţ¬°´ÏÂS1¼ü²âÖÜÆÚ
ÓÃLCD1602ÏÔʾ
********************************************************************/
void main()
{ unsigned char i,x;
unsigned char CH[]={"Cx="};
P1M0 = 0x00;
P1M1 = 0x00;
P2M0 = 0x00;
P2M1 = 0x00;
P4M0 = 0x00;
P4M1 = 0x00;
P5M0 = 0x00;
P5M1 = 0x00;
LCD_Initial();
for(i=0;i<3;i++)disp(i,CH[i]);
ACC=P_SW1;
ACC &=~(CCP_S0|CCP_S1); //CCP_S0=0£¬CCP_S1=0
P_SW1=ACC; //P1.1-CCP0£¬P1.0-CCP1
CCON=0x00; //PCAÄ£¿é0µÄCCF0Çå0£¬Í£Ö¹PCA¶¨Ê±Æ÷
CCAP0L=0;
CCAP0H=0;
CMOD=0x00; //PCAʱÖÓԴΪϵͳʱÖÓ12·ÖƵ£¨1¦Ìs£©£¬²»ÔÊÐíÆäÒç³öÖжÏ
CCAPM0=0x11; //ϽµÑز¶»ñ£¬Ê¹ÄÜCCF0ÖжÏ
EA=1;
while(P20); //µÈ´ý°´¼ü¼ì²âÖÜÆÚ
while(1)
{
x=c/10000; //ÇóÍòλÊý
disp(3,x+0x30);
x=(c%10000)/1000; //ÇóǧλÊý
disp(4,x+0x30);
x=(c%1000)/100; //Çó°ÙλÊý
disp(5,x+0x30);
x=(c%100)/10; //ÇóʮλÊý
disp(6,x+0x30);
x=c%10; //Çó¸öλÊý
disp(7,x+0x30);
disp(8,'n'); //ÏÔʾµ¥Î»us
disp(9,'F');
delay_ms(5000); //´óԼÿ5Ãë¼ì²âÒ»´Î
}
}
代码在编译的过程没有出现错误提示,烧录进单片机,单片机上的显示屏显示不了,一直都是这样,求解