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