www.pudn.com > FLUX-SENSOR-GSM-WITH-VOICE.rar > main.c, change:2014-02-08,size:2824b


#include <REGX51.H> 
#include"lcd.h" 
#include"serial.h" 
#include<string.h> 
 
sbit sen1=P1^0; 
sbit sen2=P1^2; 
sbit sen3=P1^3; 
sbit swt=P1^1;  
 
sbit v1=P0^0; 
sbit v2=P0^1; 
sbit v3=P0^2; 
sbit v4=P0^3; 
 
void initialize_GSM_modem(void); 
void GSM_data_send(); 
 
 
void main() 
{	v1=1; 
    v2=1; 
    v3=1; 
	v4=1; 
	lcd_init(); 
	InitSerial(); 
    initialize_GSM_modem(); 
	cmd(0x80); 
	write("  HAND TALKING  "); 
	cmd(0xC0); 
	write("     SYSTEM     "); 
 
	while(1) 
	{ 
	   	if(swt==1) 
		{  
		   cmd(0x8f);												  
	    	write("*"); 
 
		if(sen1==0) 
		{	 
		    v1=0; 
		    v2=1; 
		    v3=1; 
			cmd(0x80);												  
			write(" MOVEMENT - 1  "); 
			cmd(0xC0); 
			write("     VOICE 1    "); 
			GSM_data_send(); 
	       	send1("Come Soon....."); 
			send(0x1A); 
			delay(100); 
		} 
		 if(sen2==0) 
		{ 
			v1=1; 
		    v2=0; 
		    v3=1; 
			cmd(0x80);												  
			write(" MOVEMENT - 2  "); 
			cmd(0xC0); 
			write("     VOICE 2    "); 
			GSM_data_send(); 
	       	send1("Take Water...."); 
			send(0x1A); 
			delay(100); 
		} 
			 if(sen3==0) 
		{ 
			v1=1; 
		    v2=1; 
		    v3=0; 
			cmd(0x80);												  
			write(" MOVEMENT - 3  "); 
			cmd(0xC0); 
			write("     VOICE 3    "); 
			GSM_data_send(); 
	       	send1("Please fan on......"); 
			send(0x1A); 
			delay(100); 
		} 
 
		else 
			{ 
			v1=1; 
		    v2=1; 
		    v3=1; 
			cmd(0x80);												  
			write("    NORMAL     "); 
			cmd(0xC0); 
			write("                "); 
			delay(100); 
		} 
		} 
 
	if(swt==0) 
		{  
		   cmd(0x8f);												  
	    	write(" "); 
 
		if(sen1==0) 
		{	 
		    v1=0; 
		    v2=1; 
		    v3=1; 
			cmd(0x80);												  
			write(" MOVEMENT - 1  "); 
			cmd(0xC0); 
			write("     VOICE 1    "); 
			delay(100); 
		} 
		 if(sen2==0) 
		{ 
			v1=1; 
		    v2=0; 
		    v3=1; 
			cmd(0x80);												  
			write(" MOVEMENT - 2  "); 
			cmd(0xC0); 
			write("     VOICE 2    "); 
			delay(100); 
		} 
			 if(sen3==0) 
		{ 
			v1=1; 
		    v2=1; 
		    v3=0; 
			cmd(0x80);												  
			write(" MOVEMENT - 3  "); 
			cmd(0xC0); 
			write("     VOICE 3    "); 
			delay(100); 
		} 
 
		else 
			{ 
			v1=1; 
		    v2=1; 
		    v3=1; 
			cmd(0x80);												  
			write("    NORMAL     "); 
			cmd(0xC0); 
			write("                "); 
			delay(100); 
		} 
		} 
 
	} 
} 
 
void initialize_GSM_modem(void) 
{ 
	send1("AT\r"); 
	delay(100); 
	send1("AT+CMGF=1\r"); 
	delay(100); 
	send1("AT+CMGS=\"8508732412\"\r"); 
	delay(100);												  //8508732412 
                                                              // 8124743510 
	send1("DEVICE INITIALIZED"); 
	send(0x1A); 
	delay(100); 
	delay(100); 
	delay(100); 
} 
void GSM_data_send() 
{ 
	send1("AT\r"); 
	delay(100); 
	send1("AT+CMGF=1\r"); 
	delay(100); 
	send1("AT+CMGS=\"8508732412\"\r"); 
	delay(100); 
}