I get a syntax error while compiling the program on mplab c18
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 // Keypad module connections char keypadPort at PORTB; // End Keypad module connections // LCD module connections sbit LCD_RS at LATC4_bit; sbit LCD_EN at LATC5_bit; sbit LCD_D4 at LATC0_bit; sbit LCD_D5 at LATC1_bit; sbit LCD_D6 at LATC2_bit; sbit LCD_D7 at LATC3_bit; sbit LCD_RS_Direction at TRISC4_bit; sbit LCD_EN_Direction at TRISC5_bit; sbit LCD_D4_Direction at TRISC0_bit; sbit LCD_D5_Direction at TRISC1_bit; sbit LCD_D6_Direction at TRISC2_bit; sbit LCD_D7_Direction at TRISC3_bit; // End LCD module connections #define HEATER PORTD.RD0 #define FAN PORTD.RD1 #define ENTER 15 #define CLEAR 13 #define ON 1 #define OFF 0 void main() { unsigned short kp,Txt[14]; unsigned short Temp_Ref ; // Reference Temperature unsigned char inTemp; unsigned int temp; float mV, ActualTemp; Keypad_Init(); // Initialize Keypad ANSELC = 0; // Configure PORTC as digital I/O ANSELB = 0; // Configure PORTB as digital I/O ANSELD = 0; // Configure PORTD as digital I/O TRISA0_bit = 1; //Configure AN0 (RA0) as input TRISC = 0; //PORTC are outputs (LCD) TRISD0_bit=0; //RD0 is output (Heater) TRISD1_bit=0; //RD1 is output (Fan) Lcd_Init(); // Initialize LCD Lcd_Cmd(_LCD_CLEAR); // Clear display Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off Lcd_Out(1, 4, "Automatic"); Lcd_Out(2, 2, "Temp Control"); delay_ms(2000); //2s delay HEATER = OFF; FAN = OFF; //ON startup, read the Referance Temperature from the Keypad START: Lcd_Cmd(_LCD_CLEAR); // Clear display Lcd_Out(1, 1, "Enter Temp Ref"); Temp_Ref=0; Lcd_Out(2, 1, "Temp Ref: "); while(1) { do kp = Keypad_Key_Click(); // Store key code in kp variable while (!kp); if ( kp == ENTER )break; if (kp > 3 && kp < 8) kp = kp-1; if (kp > 8 && kp < 12) kp = kp-2; if (kp ==14)kp = 0; if ( kp == CLEAR )goto START; Lcd_Chr_Cp(kp + '0'); Temp_Ref =(10*Temp_Ref) + kp; } Lcd_Cmd(_LCD_CLEAR); // Clear display Lcd_Out(1, 1, "Temp Ref: "); intToStr( Temp_Ref,Txt); //Convert to String inTemp=Ltrim(Txt); Lcd_Out_CP(inTemp); //Display Ref Temp Lcd_Out(2, 1, "Press # to Cont."); //Wait until # is pressed kp =0; while(kp!=ENTER) { do kp = Keypad_Key_Click(); // Store key code in kp variable while(!kp); } Lcd_Cmd(_LCD_CLEAR); // Clear display Lcd_Out(1, 1, "Temp Ref: "); Lcd_Chr(1,15,223); // Different LCD displays have different // char code for degree Lcd_Chr(1,16,'C'); // Display "C" for Celsius //Program loop while(1) { //Display Referance Temperature and Actual Temperature temp = ADC_Read(0); //Read temperature from AN0 mV = temp * 5000.0/1024.0; //Convert to mV ActualTemp = mV/10.0 ; // Convert to degrees Celcius intToStr( Temp_Ref,Txt); //Convert to String inTemp=Ltrim(Txt); //Lcd_Out(1, 1, "Temp Ref: "); Lcd_Out(1, 11, inTemp); //Display Ref Temp Lcd_Out(2, 1, "Temp= "); FloatToStr(ActualTemp,Txt); //Convert to string Txt[4] = 0; Lcd_Out(2,7,Txt); Lcd_Out(2,12," "); //Compare ref temp with actual emp if (Temp_Ref > ActualTemp) //If Temp Ref is less than actual Temp, Switch ON Heater { HEATER = ON, FAN = OFF; } if (Temp_Ref < ActualTemp) //If Temp Ref is greater than actual Temp, Switch ON Fan { HEATER = OFF, FAN = ON; } if (Temp_Ref == ActualTemp) //If Temp Ref is equal to actual Temp, Switch OFF Fan and Heater { HEATER = OFF, FAN = OFF; } Delay_ms(10000); //Wait 10 s then repeat } }
This question is for guessing what error is this ? If you are new in programming, have a look at the log which accompanies the error message, and see what line is referred, and to which command.
(Error/warning message)
Preprocessor symbol `__DEBUG' is defined.
Wed Sep 27 05:40:26 2017
----------------------------------------------------------------------
Make: The target "C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.o" is out of date.
Executing: "C:\Program Files (x86)\Microchip\mplabc18\v3.47\bin\mcc18.exe" -p=18F4550 "incubat.c" -fo="incubat.o" -D__DEBUG -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
MPLAB C18 3.47 (evaluation)
Copyright 2000-2011 Microchip Technology Inc.
Days remaining until evaluation becomes feature limited: 55
WARNING: Running the compiler in extended mode will not be supported when the evaluation becomes feature limited.
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:37:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:38:Error [1105] symbol 'ANSELC' has not been defined
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:38:Error [1101] lvalue required
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:39:Error [1105] symbol 'ANSELB' has not been defined
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:39:Error [1101] lvalue required
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:40:Error [1105] symbol 'ANSELD' has not been defined
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:40:Error [1101] lvalue required
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:41:Error [1105] symbol 'TRISA0_bit' has not been defined
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:41:Error [1101] lvalue required
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:42:Error [1105] symbol 'TRISC' has not been defined
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:42:Error [1101] lvalue required
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:43:Error [1105] symbol 'TRISD0_bit' has not been defined
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:43:Error [1101] lvalue required
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:44:Error [1105] symbol 'TRISD1_bit' has not been defined
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:44:Error [1101] lvalue required
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:46:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:47:Error [1105] symbol '_LCD_CLEAR' has not been defined
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:47:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:48:Error [1105] symbol '_LCD_CURSOR_OFF' has not been defined
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:48:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:49:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:50:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:51:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:53:Error [1105] symbol 'PORTD' has not been defined
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:53:Error [1151] struct or union object designator expected
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:53:Error [1101] lvalue required
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:54:Error [1105] symbol 'PORTD' has not been defined
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:54:Error [1151] struct or union object designator expected
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:54:Error [1101] lvalue required
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:58:Error [1105] symbol '_LCD_CLEAR' has not been defined
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:58:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:59:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:61:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:65:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:72:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:75:Error [1105] symbol '_LCD_CLEAR' has not been defined
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:75:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:76:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:77:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:78:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:79:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:80:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:86:Warning [2058] call of function without prototype
C:\Users\iroabueke bethel\Desktop\New folder (3)\incubat.c:89:Error [1105] symbol '_LCD_CLEAR' has not been defined
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Users\iroabueke bethel\Desktop\New folder (3)\incubator.mcp' failed.
Language tool versions: mpasmwin.exe v5.54, mplink.exe v5.00, mcc18.exe v3.47, mplib.exe v5.00
Preprocessor symbol `__DEBUG' is defined.
Wed Sep 27 05:40:28 2017
----------------------------------------------------------------------
BUILD FAILED
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?