jey86
Newbie level 3
I wrote a ADC program for pic16f884.
i received this error.
please help me.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 #include <pic.h> #define _XTAL_ FREQ 4000000 void cp2102_out(unsigned char data); unsigned int a2d_result; unsigned int voltage; unsigned char dig1; unsigned char dig2; void main() { TRISA=0X01; //RA0 is analogue input TRISB=0; TRISC=0X80; //RC6 as TX, RC7 as RX PORTC=0; ADCON0=0X41; //Fosc/8 , ch-0 , AD ON ADCON1=0X0E; //left justify, RA0 analogue , VDD & VSS Vref OPTION=0X07; TMR0=0; TXSTA=0X24; //transmitting control RCSTA=0X90; //receiving control SPBRG=25; //boud rate T0IF=0; //interrupt controlls T0IE=1; // '' ADIF=0; // '' ADIE=1; // '' PEIE=1; // '' GIE=1; //interrupt controlls dig1=voltage/10; dig2=voltage%10; while(1) { cp2102_out(dig1+0x30); //data out to usb cp2102_out('.'); cp2102_out(dig2+0x30); //data out to usb } } void interrupt isr() { double temp; if(T0IF==1){ //wait for capacitor charging GO=1; //A2D convertion start T0IF=0; } if(ADIF==1){ //digital convertion a2d_result=0; a2d_result=ADRESH; a2d_result=a2d_result<<2; ADRESL=ADRESL>>6; a2d_result=a2d_result + ADRESL; ADIF==0; } temp=(double)50/(double)1023; voltage = temp * (double)a2d_result; } void cp2102_out(unsigned char data) { while(!TXIF){ } TXREG=data; }
i received this error.
Code:
Make: The target "C:\Users\jey\Desktop\pic\bdd.p1" is out of date.
Executing: "C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe" --pass1 C:\Users\jey\Desktop\pic\bdd.c -q --chip=16F884 -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
Error [192] C:\Users\jey\Desktop\pic\bdd.c; 18.1 undefined identifier "OPTION"
Warning [356] C:\Users\jey\Desktop\pic\bdd.c; 60.36 implicit conversion of float to integer
********** Build failed! **********
please help me.
Last edited by a moderator: