keil出现问题,我觉得是pic.h这个头文件没有的原因,然后导致下面函数变量这些没有定义,但是这个keil软件我的安装是没有问题的,所以想问问解决方法#include<pic.h>__CONFIG(0x1832);union adres{int y1;unsigned char adre[2];}adresult;int AD_Value;bit sci_Sign,js=0;int Order[3];int buf[4];void adinitial(void);void sciint(void);void ad_Collect(void);void sci(int);//*SCI部件接收初始化子程序*/void sciint(){TRISC7= 1 ;// |= 0xc0;//设置为输入 TRISC6= 1 ;BRGH = 1 ; //高波特率选择位SPBRG = 25 ; //((20000000/9600)/16)-1SYNC = 0 ;//异步SPEN = 1 ;//串口使能RCIE = 1 ;// USART数据接收中断使能位TXIE = 0 ;//USART数据发送中断使能位TXEN = 1 ;//发送CREN = 1 ;//连续接收使能位PEIE= 1 ; //开中断} //A/D 转换初始化子程序void adinitial(){ADCON0=0X41;//ADCON1=0X8E;TRISA0=1;}void ad_Collect(){float temp;ADGO=1;while(!ADIF);ADIF=0;adresult.adre[0]=ADRESL;//读取AD转换的结果到联合体数组. adresult.adre[1]=ADRESH;// AD_value="/ADRESH;//temp=(float)adresult.y1;//*5)/1023)*1000;temp=((temp*5)/1023)*100;AD_Value=(int)(temp*5);//adresult.y1;//(int)temp;}void" sci(int tran){while(!TXIF);TXREG=tran; //*发出一个字符*/TXIF=0;}void interrupt SCI_Admit(void){// sci_Sign=1;int temp;if(RCIF) //判断是否是接收中断 { if(js) { if(Order[0]=='$') { temp++; Order[temp]=RCREG; if(temp==2) { js=0; sci_Sign=1; temp=0; } } else js=0; // RCIF=0; } else { Order[0]=RCREG; js=1; temp=0; } RCIF=0;}}/* if(js) { if(Order[1]=='R') { Order[2]=RCREG; sci_Sign=1; js=0; } else { Order[1]=RCREG; } temp++; Order[temp]=RCREG; if(temp==2) js=0; }*/void int_to_asc(int dat){int temp;buf[0]=(dat/1000)+'0';temp=dat%100;buf[1]=((dat%1000)/100)+'0';buf[2]=((dat%1000)%100)/10+'0';buf[3]=((dat%1000)%100)%10+'0';}void main(){int temp='V';adinitial();sciint(); //*SCI部件初始化*/sci_Sign=0;ei();TXEN = 1 ;//发送CREN = 1 ;//连续接收使能位while(1){// ad_Collect(); if(sci_Sign) { if(Order[0]=='$') { if(Order[1]=='R'&&Order[2]=='V') { ad_Collect(); //AD_value="/123; //sci(AD_Value); int_to_asc(AD_Value); sci(temp); if(buf[0]!='0') sci(buf[0]); sci(buf[1]); sci('."'); sci(buf[2]); sci(buf[3]); Order[0]=0; Order[1]=0; Order[2]==0; } // sci(temp); } sci_Sign=0; }}}错误: newchuankou.c(1): warning C318: can't open file 'pic.h'
NEWCHUANKOU.C(2): error C141: syntax error near '0x1832'
NEWCHUANKOU.C(18): error C202: 'TRISC7': undefined identifier
NEWCHUANKOU.C(19): error C202: 'TRISC6': undefined identifier
NEWCHUANKOU.C(20): error C202: 'BRGH': undefined identifier
NEWCHUANKOU.C(21): error C202: 'SPBRG': undefined identifier
NEWCHUANKOU.C(22): error C202: 'SYNC': undefined identifier
NEWCHUANKOU.C(23): error C202: 'SPEN': undefined identifier
NEWCHUANKOU.C(24): error C202: 'RCIE': undefined identifier
NEWCHUANKOU.C(25): error C202: 'TXIE': undefined identifier
NEWCHUANKOU.C(26): error C202: 'TXEN': undefined identifier
NEWCHUANKOU.C(27): error C202: 'CREN': undefined identifier
NEWCHUANKOU.C(28): error C202: 'PEIE': undefined identifier
NEWCHUANKOU.C(34): error C202: 'ADCON0': undefined identifier
NEWCHUANKOU.C(35): error C202: 'ADCON1': undefined identifier
NEWCHUANKOU.C(36): error C202: 'TRISA0': undefined identifier
NEWCHUANKOU.C(41): error C202: 'ADGO': undefined identifier
NEWCHUANKOU.C(42): error C202: 'ADIF': undefined identifier
NEWCHUANKOU.C(43): error C202: 'ADIF': undefined identifier
NEWCHUANKOU.C(44): error C202: 'ADRESL': undefined identifier
NEWCHUANKOU.C(45): error C202: 'ADRESH': undefined identifier
NEWCHUANKOU.C(53): error C202: 'TXIF': undefined identifier
NEWCHUANKOU.C(54): error C202: 'TXREG': undefined identifier
NEWCHUANKOU.C(55): error C202: 'TXIF': undefined identifier
NEWCHUANKOU.C(57): error C141: syntax error near 'interrupt'
NEWCHUANKOU.C(61): error C202: 'RCIF': undefined identifier
NEWCHUANKOU.C(68): error C202: 'RCREG': undefined identifier
NEWCHUANKOU.C(82): error C202: 'RCREG': undefined identifier
NEWCHUANKOU.C(86): error C202: 'RCIF': undefined identifier
newchuankou.c - 28 Error(s), 1 Warning(s).
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>