Page 1 of 1

hi

Posted: 23 Apr 2013 18:30
by kapistran
:oops: the code written below gives an error during compilation can you help me to solve that problem
sbit sensorA at RA0_bit;
sbit LCD_RS at RB7_bit;
sbit LCD_EN at RB6_bit;
sbit LCD_D4 at RB5_bit;
sbit LCD_D5 at RB4_bit;
sbit LCD_D6 at RB3_bit;
sbit LCD_D7 at RB2_bit;
sbit LCD_RS_direction at TRISB7_bit;
sbit LCD_EN_direction at TRISB6_bit;
sbit LCD_D4_direction at TRISB5_bit;
sbit LCD_D5_direction at TRISB4_bit;
sbit LCD_D6_direction at TRISB3_bit;
sbit LCD_D7_direction at TRISB2_bit;
void main(){
trisA=0b00000001;
trisB=0boooooooo;
portB=0b00000000;
trisc.b3=0;
trisc.b4=0;
trisc.b3=0;
portc.b4=0;
portc.b3=0;
adcon1=0b00000111;//make portA pins digital i/os
lcd_Init();
lcd_Cmd(_LCD_CLEAR);
lcd_Cmd(_LCD_CURSOR_OFF);
while(1)
{
if(!sensorA)//if portA RA0_bit is low
{
lcd_out(1,1"GSM SYSTEM");
lcd_out(2,1"NO GAS LEAKAGE");
portC=0;
}
if(!sensorA)
{
lcd_out(1,1,"GSM SYSTEM");
lcd_out(2,1,"GAS LEAKAGE");
UART1_INIT(9600);
uart1_write("at+cmgf=1\t\n\r");
uart1_write("at+cmgs=0653101078\n\r\t");
uart1_write_text("gas LEAKAGE\n\r");
portC=0*18;
while(1)
{
if(!sensorA)
break;
}
}
}
}

Re: hi

Posted: 25 Apr 2013 16:08
by veljko.pavlovic
Hello,

Which MCU do you use?

Best regards,
Veljko Pavlovic.

Re: hi

Posted: 27 Apr 2013 15:26
by kapistran
PIC 16F877a

Re: hi

Posted: 27 Apr 2013 16:08
by kapistran
i need to creat the gsm based gas leakage detector and alert system by using pic 16f877a as a controller.that code i send to you last week gives an errors when i compiled.The circuit composed of the following component:-
1.lcd 2x16
2.gas sensor
3.gsm modem sim300
4.buzzer
Gas sensor act as input to the microcontroller so when the gas is detected through a gas sensor pin RA0 at mcu will be high so i need the lcd to display the message as gas leakage and to send the message through predefined number by using gsm modem and vice versa when pin RA0 is low also i need a buzzer to sound when the gas is detected. please check those code which i send to you and help me to correct those errors if its possible sir.

Re: hi

Posted: 29 Apr 2013 16:07
by veljko.pavlovic
Hello,

Please try with attached file.
There was minor errors and now it should work.

Best regards,
Veljko Pavlovic.

Re: hi

Posted: 29 Apr 2013 17:18
by kapistran
:) thanks very much sir the program is successfully compiled without error