Brillasoko
Newbie level 6
- Joined
- Mar 22, 2013
- Messages
- 13
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,391
I wrote some code in MikroC using a PIC18F4550 to switch on or off an airconditioner based on a sensor detecting the presence of people in a room.
This is the code:
But in bulding it I am getting these error messages:
46 324 Undeclared identifier 'Lcd_Init' in expression AirC Project.c
47 324 Undeclared identifier 'Lcd_Cmd' in expression AirC Project.c
48 324 Undeclared identifier 'Lcd_Cmd' in expression AirC Project.c
49 324 Undeclared identifier 'Lcd_Out' in expression AirC Project.c
55 324 Undeclared identifier 'Lcd_Cmd' in expression AirC Project.c
56 324 Undeclared identifier 'Lcd_Out' in expression AirC Project.c
62 324 Undeclared identifier 'Lcd_Cmd' in expression AirC Project.c
63 324 Undeclared identifier 'Lcd_Out' in expression AirC Project.c
100 324 Undeclared identifier 'Lcd_Cmd' in expression AirC Project.c
101 324 Undeclared identifier 'Lcd_Out' in expression AirC Project.c
107 324 Undeclared identifier 'Lcd_Cmd' in expression AirC Project.c
108 324 Undeclared identifier 'Lcd_Out' in expression AirC Project.c
110 324 Undeclared identifier 'Lcd_Out' in expression AirC Project.c
114 312 Internal error '' AirC Project.c
0 102 Finished (with errors): 02 Apr 2013, 08:05:57 AirC Project.mcppi
I have checked the LCD libraries in the library manager. Can anyone help me solve this problem?
Thanks
This is the code:
Code:
// LCD Module Connections
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_RS_Direction at TRISB0_bit;
sbit LCD_EN_Direction at TRISB1_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
// End LCD Module Connections
int i; // Timing counter variable
void tempCheck(); // Various control functions
void crosscheck();
void finalCheck();
void crosscheckend();
void secondCheck();
void short_delay();
void medium_delay();
void long_delay();
void main()
{
CMCON=0x07;
ADCON1=0x0f;
OSCCON=0x60;
ADRESH=ADRESL=0;
TRISA=0xff; // Sensor Input
PORTA=0;
TRISB=0; // LCD Output
PORTB=0;
TRISC=0; // Relay Outputs
PORTC=0;
delay_ms(1000);
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1,1,"System On");
delay_ms(2000);
while(1)
{
if(PORTA.f0==1) // Presence Detected
{
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"Area Occupied");
short_delay();
}
else // Detection of unoccupation
{
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"Area Unoccupied");
medium_delay();
secondCheck();
}
}
}
// Definition of various functions
void short_delay() // For 5s delay
{
for(i=0;i<5;i++)
{
delay_ms(1000);
}
}
void medium_delay() // For 10s delay
{
for(i=0;i<10;i++)
{
delay_ms(1000);
}
}
void long_delay() // For 15s delay
{
for(i=0;i<15;i++)
{
delay_ms(1000);
}
}
void secondCheck() // Check before compressor is switched off
{
if(PORTA.f0==1)
{
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"Area Occupied");
short_delay();
}
else
{
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"Area Unoccupied");
PORTC.f0=1;
Lcd_Out(2,1,"Compressor Off");
medium_delay();
tempCheck();
}
}
void tempCheck() // Intermediate check for temporary vacation
{
if(PORTA.f0==1)
{
medium_delay();
crosscheck();
}
else
{
long_delay();
finalCheck();
}
}
void crosscheck() // Crosscheck before restoring compressor operation
{
if(PORTA.f0==1)
{
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"Area Occupied");
PORTC.f0=0;
Lcd_Out(2,1,"Compressor On");
short_delay();
}
else
{
long_delay();
finalCheck();
}
}
void finalCheck() //Check before A/C Shutdown
{
if(PORTA.f0==1)
{
medium_delay();
crosscheckend();
}
else
{
PORTC.f1=1;
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"AirCon OFF!");
}
}
void crosscheckend() // Final Crosscheck
{
if(PORTA.f0==1)
{
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"Area Occupied");
PORTC.f0=0;
Lcd_Out(2,1,"Compressor On");
short_delay();
}
else
{
PORTC.f1=1;
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,"AirCon OFF!");
}
}
But in bulding it I am getting these error messages:
46 324 Undeclared identifier 'Lcd_Init' in expression AirC Project.c
47 324 Undeclared identifier 'Lcd_Cmd' in expression AirC Project.c
48 324 Undeclared identifier 'Lcd_Cmd' in expression AirC Project.c
49 324 Undeclared identifier 'Lcd_Out' in expression AirC Project.c
55 324 Undeclared identifier 'Lcd_Cmd' in expression AirC Project.c
56 324 Undeclared identifier 'Lcd_Out' in expression AirC Project.c
62 324 Undeclared identifier 'Lcd_Cmd' in expression AirC Project.c
63 324 Undeclared identifier 'Lcd_Out' in expression AirC Project.c
100 324 Undeclared identifier 'Lcd_Cmd' in expression AirC Project.c
101 324 Undeclared identifier 'Lcd_Out' in expression AirC Project.c
107 324 Undeclared identifier 'Lcd_Cmd' in expression AirC Project.c
108 324 Undeclared identifier 'Lcd_Out' in expression AirC Project.c
110 324 Undeclared identifier 'Lcd_Out' in expression AirC Project.c
114 312 Internal error '' AirC Project.c
0 102 Finished (with errors): 02 Apr 2013, 08:05:57 AirC Project.mcppi
I have checked the LCD libraries in the library manager. Can anyone help me solve this problem?
Thanks
Last edited by a moderator: