PICC 8.05<br />报错如下:<br />Clean: Deleting intermediary and output files.<br />Clean: Deleted file "D:PIC-mcu estlcd.cce".<br />Clean: Done.<br />Executing: "C:HT-PICBINPICC.EXE" -C -E"lcd.cce" "lcd.c" -O"lcd.obj" -Zg9 -O -ASMLIST -Q -MPLAB -16F505<br />Error[000] D:PIC-mcu estlcd.c 21 : not an argument: i<br />Warning[000] D:PIC-mcu estlcd.c 21 : external declaration inside function<br />Error[000] D:PIC-mcu estlcd.c 21 : not an argument: count<br />Warning[000] D:PIC-mcu estlcd.c 21 : external declaration inside function<br />Error[000] D:PIC-mcu estlcd.c 22 : not an argument: t0<br />Warning[000] D:PIC-mcu estlcd.c 22 : external declaration inside function<br />Error[000] D:PIC-mcu estlcd.c 22 : not an argument: t1s<br />Warning[000] D:PIC-mcu estlcd.c 22 : external declaration inside function<br />Error[000] D:PIC-mcu estlcd.c 22 : not an argument: tm<br />Warning[000] D:PIC-mcu estlcd.c 22 : external declaration inside function<br />Error[000] D:PIC-mcu estlcd.c 23 : not an argument: key_state<br />Warning[000] D:PIC-mcu estlcd.c 23 : external declaration inside function<br />Error[000] D:PIC-mcu estlcd.c 24 : not an argument: key_tcc<br />Warning[000] D:PIC-mcu estlcd.c 24 : external declaration inside function<br />Error[000] D:PIC-mcu estlcd.c 25 : not an argument: key_temp<br />Warning[000] D:PIC-mcu estlcd.c 25 : external declaration inside function<br />Error[000] D:PIC-mcu estlcd.c 26 : not an argument: new_key<br />Warning[000] D:PIC-mcu estlcd.c 26 : external declaration inside function<br />Error[000] D:PIC-mcu estlcd.c 27 : not an argument: run<br />Warning[000] D:PIC-mcu estlcd.c 27 : external declaration inside function<br />Error[000] D:PIC-mcu estlcd.c 28 : not an argument: buf<br />Warning[000] D:PIC-mcu estlcd.c 28 : external declaration inside function<br />Error[000] D:PIC-mcu estlcd.c 29 : not an argument: timer_5ms_ok<br />Warning[000] D:PIC-mcu estlcd.c 29 : external declaration inside function<br />Error[000] D:PIC-mcu estlcd.c 29 : illegal initialisation<br />Error[000] D:PIC-mcu estlcd.c 31 : not an argument: seg_tbl<br />Warning[000] D:PIC-mcu estlcd.c 31 : external declaration inside function<br />Error[000] D:PIC-mcu estlcd.c 31 : illegal initialisation<br />Error[000] D:PIC-mcu estlcd.c 34 : not an argument: io_init<br />Warning[000] D:PIC-mcu estlcd.c 34 : external declaration inside function<br />Error[000] D:PIC-mcu estlcd.c 34 : ; expected<br />Error[000] D:PIC-mcu estlcd.c 35 : { expected<br />Warning[000] D:PIC-mcu estlcd.c 40 : unused variable definition: timer_5ms_ok (from line 29)<br />Warning[000] D:PIC-mcu estlcd.c 40 : unused variable declaration: t0 (from line 22)<br />Warning[000] D:PIC-mcu estlcd.c 40 : unused variable declaration: run (from line 27)<br />Warning[000] D:PIC-mcu estlcd.c 40 : unused variable declaration: t1s (from line 22)<br />Warning[000] D:PIC-mcu estlcd.c 40 : unused variable declaration: key_state (from line 23)<br />Warning[000] D:PIC-mcu estlcd.c 40 : unused variable definition: seg_tbl (from line 31)<br />Warning[000] D:PIC-mcu estlcd.c 40 : unused variable declaration: count (from line 21)<br />Warning[000] D:PIC-mcu estlcd.c 40 : unused variable declaration: key_temp (from line 25)<br />Warning[000] D:PIC-mcu estlcd.c 40 : unused variable declaration: tm (from line 22)<br />Warning[000] D:PIC-mcu estlcd.c 40 : unused variable declaration: io_init (from line 34)<br />Warning[000] D:PIC-mcu estlcd.c 40 : unused variable declaration: buf (from line 28)<br />Warning[000] D:PIC-mcu estlcd.c 40 : unused variable declaration: key_tcc (from line 24)<br />Warning[000] D:PIC-mcu estlcd.c 40 : unused variable declaration: i (from line 21)<br />Warning[000] D:PIC-mcu estlcd.c 40 : unused variable declaration: new_key (from line 26)<br />Error[000] D:PIC-mcu estlcd.c 44 : function redefined: showbuf<br />Error[000] D:PIC-mcu estlcd.c 45 : undefined identifier: buf<br />Error[000] D:PIC-mcu estlcd.c 45 : pointer required<br />Error[000] D:PIC-mcu estlcd.c 45 : pointer required<br />Error[000] D:PIC-mcu estlcd.c 45 : undefined identifier: seg_tbl<br />Error[000] D:PIC-mcu estlcd.c 45 : pointer required<br />Error[000] D:PIC-mcu estlcd.c 45 : pointer required<br />Error[000] D:PIC-mcu estlcd.c 46 : pointer required<br />Error[000] D:PIC-mcu estlcd.c 46 : pointer required<br />Error[000] D:PIC-mcu estlcd.c 46 : pointer required<br />Error[000] D:PIC-mcu estlcd.c 46 : pointer required<br />Error[000] D:PIC-mcu estlcd.c 74 : undefined identifier: tm<br />Error[000] D:PIC-mcu estlcd.c 80 : undefined identifier: tm<br />Error[000] D:PIC-mcu estlcd.c 102 : undefined identifier: timer_5ms_ok<br />Error[000] D:PIC-mcu estlcd.c 103 : undefined identifier: TMRO<br />Error[000] D:PIC-mcu estlcd.c 106 : undefined identifier: t0<br />Error[000] D:PIC-mcu estlcd.c 110 : undefined identifier: t1s<br />Error[000] D:PIC-mcu estlcd.c 114 : undefined identifier: tm<br />Error[000] D:PIC-mcu estlcd.c 120 : undefined identifier: key_state<br />Error[000] D:PIC-mcu estlcd.c 122 : undefined identifier: new_key<br />Warning[000] D:PIC-mcu estlcd.c 122 : function declared implicit int<br />Error[000] D:PIC-mcu estlcd.c 130 : undefined identifier: new_key<br />Warning[000] D:PIC-mcu estlcd.c 142 : function declared implicit int<br />Error[000] D:PIC-mcu estlcd.c 142 : undefined identifier: new_key<br />Error[000] D:PIC-mcu estlcd.c 146 : undefined identifier: key_temp<br />Error[000] D:PIC-mcu estlcd.c 153 : undefined identifier: key_tcc<br />Warning[000] D:PIC-mcu estlcd.c 166 : function declared implicit int<br />Error[000] D:PIC-mcu estlcd.c 178 : undefined identifier: key_tcc<br />Error[000] D:PIC-mcu estlcd.c 194 : undefined identifier: timer_5ms_ok<br />Warning[000] D:PIC-mcu estlcd.c 205 : unused variable definition: newkey (from line 189)<br />Halting build on first failure as requested.<br />BUILD FAILED: Mon Sep 17 16:16:52 2007<br /><br /><br />程序:<br />#include <pic.h><br />#include <pic16505.h><br /><br />#define uchar unsigned char <br />#define uint unsigned int <br />#define inc 0x01<br />#define dec 0x02<br /><br />//函数声明<br />void io_init(void);<br />uchar keyscan(void);<br />void keyDo(uchar key);<br />void lcd_display(void);<br />void lcd_test(void);<br />void delay(uchar cnt);<br />void time0();<br />void showbuf(uchar x)<br />//end<br /><br />//全局变量声明<br />unsigned char i,count;<br />unsigned char t0,t1s,tm;<br />unsigned char key_state;<br />unsigned char key_tcc;<br />unsigned char key_temp;<br />unsigned char new_key;<br />unsigned char run;<br />unsigned char buf[2];<br />bit timer_5ms_ok=0;<br /><br />unsigned char seg_tbl[10]={1,2,3};<br /><br />void io_init()<br />{<br />OPTION=0x83;//FS/4时钟128分频<br />TRISB=0x06;<br />TRISC=0x00;<br />PORTC=0xff;<br />TMR0=217;<br />}<br /><br />//bin-bcd<br />void showbuf(uchar x)<br />{<br /> buf[0] = seg_tbl[x/10];<br /> buf[1] = seg_tbl[x%10];<br />}<br /><br />//延时函数<br />void delay(uchar cnt)<br />{<br />uchar j,x;<br />for(j=0;j<cnt;j++)<br />{<br /> for(x=0;x<256;x++);<br />}<br />}<br /><br />//按键扫描<br />uchar keyscan()<br />{<br />uchar temp;<br />temp=PORTB;<br />if(temp&0x03!=0x03)<br />return temp;<br />return 0x03;<br />}<br /><br />//按键处理<br />void keyDo(uchar key)<br />{<br /> if(key==inc)<br /> {<br /> tm++;<br /> if(tm>99)<br /> tm=0;<br /> }<br /> else if(key==dec)<br /> {<br /> if(tm==0)<br /> tm=99;<br /> else<br /> tm--;<br /> }<br />}<br /><br />//lcd_test<br />void lcd_test()<br />{<br />}<br /><br />//lcd_display<br />void lcd_display()<br />{<br />}<br /><br />//5ms时间到处理一次<br />void time0()<br />{<br />if(TMR0<217)<br /> {<br /> timer_5ms_ok=1;<br /> TMRO=217;<br /> if(RC3==1)<br /> {<br /> t0++;<br /> if(t0>200)<br /> {<br /> t0=0;<br /> t1s++;<br /> if(t1s>=60)<br /> {<br /> t1s=0;<br /> tm--;<br /> if(tm==0)<br /> RC3=0;<br /> }<br /> }<br /> }<br /> if (key_state == 0)<br /> {<br /> new_key = Keyscan();<br /> if (new_key != 0x03)<br /> {<br /> key_state++;<br /> }<br /> }<br /> else if (key_state < 5)<br /> {<br /> if (Keyscan() == new_key)<br /> {<br /> key_state++;<br /> }<br /> else<br /> {<br /> key_state = 0;<br /> }<br /> }<br /> else if (key_state == 5)<br /> {<br /> key_state++;<br /> KeyDo(new_key);<br /> }<br /> else if (key_state == 6)<br /> {<br /> key_temp = Keyscan();<br /> if (key_temp == 0x03)<br /> {<br /> key_state ++;<br /> }<br /> else if (key_temp == dec || key_temp == inc)<br /> {<br /> if (key_tcc == 250)<br /> {<br /> key_tcc = 220;<br /> KeyDo(key_temp);<br /> }<br /> else<br /> {<br /> key_tcc++;<br /> }<br /> }<br /> }<br /> else if (key_state < 12)<br /> {<br /> if (KeyScan() == 0x03)<br /> {<br /> key_state ++;<br /> }<br /> else<br /> {<br /> key_state = 6;<br /> }<br /> }<br /> else if (key_state == 12)<br /> {<br /> key_state = 0;<br /> key_tcc = 0;<br /> } <br /> }<br />} <br /> <br />void workdo()<br />{<br />}<br /><br />void main(void)<br />{<br />uchar newkey;<br />io_init();<br />lcd_test();<br />while(1)<br /> { <br /> while(timer_5ms_ok)<br /> {<br /> timer_5ms_ok=0;<br /> if(RB2==0)<br /> RC3=1;<br /> else<br /> RC3=0;<br /> lcd_display();<br /> }<br /> time0();<br /> }<br />}<br /> |
|