SlideShare a Scribd company logo
1 of 6
Interface GSM module with PIC..
The Global System for Mobile (GSM) communication is the Second Generation of mobile technology.
Although the world is moving towards Third and Fourth generation but GSM has been the most
successful and widespread technology in the communication sector. GSM technology paved a new way
for mobile communication.
This project explains the interfacing of a GSM Module with a PIC microcontroller. It also covers a way to
dial a particular GSM mobile number as well as send a message to it using AT Commands with the
help of PIC18F4550.
Objectives:
This project has following objectives which are fulfilled using AT Commands:
1. Test the simple AT Command.
2. Find out the IMEI number of the GSM Modem.
3. Connect a call to a GSM mobile number (Dial a number).
4. Send a text message to a mobile number.
The provision of these four operations has been provided by means of four tactile switches. Each switch
corresponds to each of the above functions. AT Commands used to perform the above operations have
been given below along with their output. (For complete list of AT Commands supported by GSM Modem,
refer the list in tutorial on AT Commands.
As explained earlier (refer GSM interfacing with 8051), a line converter MAX232 is employed to convert
the RS232 logic data of GSM Module to TTL logic so that it can be processed by the microcontroller. In
this project, instead of RS232 logic data, TTL logic output has been taken and thus PIC18F4550 has
been directly connected with GSM Modem without any line converter in between. The following diagram
shows the TTL input and output of GSM modem used.
Code:-
//Program to interface GSM Modem with PIC18F4550 Microcontroller
//This code takes four choices as four inputs
//Choice 1 : Test the simple AT Command.
//Choice 2 : Find out the IMEI number of the GSM Modem.
//Choice 3 : Connect a call to a GSM mobile number.
//Choice 4 : Send a text message to a mobile number.
#define FREQ 12000000
#define baud 9600
#define spbrg_value (((FREQ/64)/baud)-1)
#define rs LATA.F0
#define rw LATA.F1
#define en LATA.F2
#define lcdport LATB
void tx_data(unsigned char);
unsigned char rx_data();
void lcd_ini();
void lcdcmd(unsigned char);
void lcddata(unsigned char);
void gsm_cmd(unsigned char *);
void output(void);
unsigned char value=0;
int i=0,j,k,temp,flag,choice;
unsigned char *starting_text="Enter choice=";
unsigned char *dial_text="Dialing...";
unsigned char *at_cmd="AT";
unsigned char *imei_cmd="AT+GSN";
unsigned char *call_cmd="ATD9xxxxxxxxx;"; // Provide a 10-Digit Mobile Number
unsigned char *sms_format="AT+CMGF=1";
unsigned char *sms_write="AT+CMGS="xxxxxxxxxx""; // 10-Digit Mobile Number
unsigned char *sms="Hello";
unsigned char *sms_report="SMS Sent...";
unsigned char sms_terminate=0x1A;
unsigned char enter=0x0D;
unsigned char *data;
void main()
{
TRISB=0; // Set Port B as output port
LATB=0;
TRISA=0;
LATA=0;
TRISD=0xFF;
LATD=0;
SPBRG=spbrg_value; // Fill SPBRG register to set the
baud rate
RCSTA.SPEN=1; // To activate serial port (Tx and
Rx pins)
TXSTA.TXEN=1; // Activate Transmissiom
RCSTA.CREN=1; // Activate Reception
PIE1.RCIE=1; // Enable Reception interrupt
INTCON.GIE=1; // Enable Global interrupt
INTCON.PEIE=1; // Enable Peripheral interrupt
lcd_ini();
while(1)
{
k=0;
lcdcmd(0x80);
while(starting_text[k]!='0')
{
lcddata(starting_text[k]);
k++;
}
//Check inputs
//Choice 1
if(PORTD.F0)
{
gsm_cmd(at_cmd);
output();
Delay_ms(1000);
}
//Choice 2
if(PORTD.F1)
{
gsm_cmd(imei_cmd);
output();
Delay_ms(1000);
}
//Choice 3
if(PORTD.F2)
{
gsm_cmd(call_cmd);
output();
Delay_ms(1000);
}
//Choice 4
if(PORTD.F3)
{
gsm_cmd(sms_format);
output();
Delay_ms(1000);
gsm_cmd(sms_write);
output();
Delay_ms(1000);
gsm_cmd(sms);
output();
tx_data(0x1A);
Delay_ms(1000);
}
}
}
void gsm_cmd(unsigned char *string)
{
i=0;j=0;
while(string[i]!='0')
{
temp=0;
if(string[i]==0x5C) // Not to send '' cahracter
i++;
tx_data(string[i]); // Send by serial communication
i++;
while(temp!=1);
}
temp=0;
tx_data(enter); // Send ASCII code for 'Enter' key
while(temp!=1);
}
void output(void) // To print data on LCD
{
lcdcmd(0x01);
i=-1;flag=0;
while(i<j)
{
if(flag>1)
{
flag=0;
Delay_ms(500);
lcdcmd(0x01);
lcdcmd(0x80);
}
if(data[i]==0x0A) // This condition is to avoid
double Enter
// during execution of a command
{
flag++;
lcdcmd(0xc0);
}
if(data[i]=='>'||data[i]=='"') // Not to print this character
{
i++;
lcdcmd(0xc0);
}
if(data[i]!=0x0D&&data[i]!=0x0A&&data[i]!=0x1A) // Condition to
print the data
// except 'Enter','New
line' and 'Submit'
{
lcddata(data[i]);
i++;
}
else
i++;
Delay_ms(300);
}
lcdcmd(0x01);
}
void tx_data(unsigned char serial_data) // Transmit data function
{
TXREG=serial_data;
while(PIR1.TXIF==0);
}
void interrupt()
{
data[j]=RCREG; // Store the data into array when Reception
interrupt occurs
value=RCREG;
j++;
temp=1;
}
void lcd_ini()
{
lcdcmd(0x38); // Configure the LCD in 8-bit mode, 2 line and 5x7
font
lcdcmd(0x0C); // Display On and Cursor Off
lcdcmd(0x01); // Clear display screen
lcdcmd(0x06); // Increment cursor
lcdcmd(0x80); // Set cursor position to 1st line, 1st column
}
void lcdcmd(unsigned char cmdout)
{
lcdport=cmdout; //Send command to lcdport=PORTB
rs=0;
rw=0;
en=1;
Delay_ms(10);
en=0;
}
void lcddata(unsigned char dataout)
{
lcdport=dataout; //Send data to lcdport=PORTB
rs=1;
rw=0;
en=1;
Delay_ms(10);
en=0;
}

More Related Content

What's hot (20)

AVR_Course_Day8 motor drive and pwm techniques
AVR_Course_Day8 motor drive and pwm techniquesAVR_Course_Day8 motor drive and pwm techniques
AVR_Course_Day8 motor drive and pwm techniques
 
Introduction to Vortex86EX Motion Control Modules
Introduction to Vortex86EX Motion Control ModulesIntroduction to Vortex86EX Motion Control Modules
Introduction to Vortex86EX Motion Control Modules
 
Pdf tp3076 national
Pdf tp3076 nationalPdf tp3076 national
Pdf tp3076 national
 
Wireless UART Controller: XR18W750
Wireless UART Controller: XR18W750Wireless UART Controller: XR18W750
Wireless UART Controller: XR18W750
 
VOCODER LST 36 pin signal data
VOCODER LST 36 pin signal dataVOCODER LST 36 pin signal data
VOCODER LST 36 pin signal data
 
VOCODER LST 72 pin signal data
VOCODER LST  72 pin signal dataVOCODER LST  72 pin signal data
VOCODER LST 72 pin signal data
 
Chapter5 dek3133
Chapter5 dek3133Chapter5 dek3133
Chapter5 dek3133
 
Uart VHDL RTL design tutorial
Uart VHDL RTL design tutorialUart VHDL RTL design tutorial
Uart VHDL RTL design tutorial
 
Uart
UartUart
Uart
 
Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)
 
Xilinxaxi uart16550
Xilinxaxi uart16550Xilinxaxi uart16550
Xilinxaxi uart16550
 
伺服馬達控制
伺服馬達控制伺服馬達控制
伺服馬達控制
 
report cs
report csreport cs
report cs
 
Assembly programming II
Assembly programming IIAssembly programming II
Assembly programming II
 
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
MEASUREMENT AND DISPLAY OF THE MAINS FREQUENCY USING PIC18F4520/50
 
Arm7 document
Arm7  documentArm7  document
Arm7 document
 
Imx53 uart- GUIDE BOOK
Imx53 uart- GUIDE BOOKImx53 uart- GUIDE BOOK
Imx53 uart- GUIDE BOOK
 
Dc40 d mk3
Dc40 d mk3Dc40 d mk3
Dc40 d mk3
 
131080111003 mci
131080111003 mci131080111003 mci
131080111003 mci
 
FPGA IMPLIMENTATION OF UART CONTTROLLER
FPGA IMPLIMENTATION OF UART CONTTROLLERFPGA IMPLIMENTATION OF UART CONTTROLLER
FPGA IMPLIMENTATION OF UART CONTTROLLER
 

Viewers also liked

An Approach to Improve the Railway Crack Detection in the Tracks by Automated...
An Approach to Improve the Railway Crack Detection in the Tracks by Automated...An Approach to Improve the Railway Crack Detection in the Tracks by Automated...
An Approach to Improve the Railway Crack Detection in the Tracks by Automated...IOSR Journals
 
Point-to-Point Protocol(PPP) CCN ppt
Point-to-Point Protocol(PPP) CCN pptPoint-to-Point Protocol(PPP) CCN ppt
Point-to-Point Protocol(PPP) CCN pptNiaz Shaikh
 
Point to-point protocol (ppp), PAP & CHAP
Point to-point protocol (ppp), PAP & CHAPPoint to-point protocol (ppp), PAP & CHAP
Point to-point protocol (ppp), PAP & CHAPNetProtocol Xpert
 
Point to-point-protocol
Point to-point-protocolPoint to-point-protocol
Point to-point-protocolamigurumi21
 
final projects
final projectsfinal projects
final projectsjayam19
 
Fully automatic anti collision train signalling project
Fully automatic anti collision train signalling projectFully automatic anti collision train signalling project
Fully automatic anti collision train signalling projectHina Saxena
 
Password based door lock system using 8051 microcontroller final report
Password based door lock system using 8051 microcontroller final reportPassword based door lock system using 8051 microcontroller final report
Password based door lock system using 8051 microcontroller final reportChinaraja Baratam
 
Accident messaging system using GPS,GSM and MEMS
Accident messaging system using GPS,GSM and MEMSAccident messaging system using GPS,GSM and MEMS
Accident messaging system using GPS,GSM and MEMSJithin Prasad
 
Gps tracking system
Gps tracking system Gps tracking system
Gps tracking system Sumit Kumar
 
Vehicle tracking system using GSM and GPS
Vehicle tracking system using GSM and GPSVehicle tracking system using GSM and GPS
Vehicle tracking system using GSM and GPSBharath Chapala
 

Viewers also liked (14)

An Approach to Improve the Railway Crack Detection in the Tracks by Automated...
An Approach to Improve the Railway Crack Detection in the Tracks by Automated...An Approach to Improve the Railway Crack Detection in the Tracks by Automated...
An Approach to Improve the Railway Crack Detection in the Tracks by Automated...
 
Sim900
Sim900Sim900
Sim900
 
Point-to-Point Protocol(PPP) CCN ppt
Point-to-Point Protocol(PPP) CCN pptPoint-to-Point Protocol(PPP) CCN ppt
Point-to-Point Protocol(PPP) CCN ppt
 
Introduction to PPP
Introduction to PPPIntroduction to PPP
Introduction to PPP
 
Point to-point protocol (ppp), PAP & CHAP
Point to-point protocol (ppp), PAP & CHAPPoint to-point protocol (ppp), PAP & CHAP
Point to-point protocol (ppp), PAP & CHAP
 
Chapter 2 point-to-point protocol (ppp)
Chapter 2   point-to-point protocol (ppp)Chapter 2   point-to-point protocol (ppp)
Chapter 2 point-to-point protocol (ppp)
 
Point to-point-protocol
Point to-point-protocolPoint to-point-protocol
Point to-point-protocol
 
final projects
final projectsfinal projects
final projects
 
Fully automatic anti collision train signalling project
Fully automatic anti collision train signalling projectFully automatic anti collision train signalling project
Fully automatic anti collision train signalling project
 
GSM Module
GSM ModuleGSM Module
GSM Module
 
Password based door lock system using 8051 microcontroller final report
Password based door lock system using 8051 microcontroller final reportPassword based door lock system using 8051 microcontroller final report
Password based door lock system using 8051 microcontroller final report
 
Accident messaging system using GPS,GSM and MEMS
Accident messaging system using GPS,GSM and MEMSAccident messaging system using GPS,GSM and MEMS
Accident messaging system using GPS,GSM and MEMS
 
Gps tracking system
Gps tracking system Gps tracking system
Gps tracking system
 
Vehicle tracking system using GSM and GPS
Vehicle tracking system using GSM and GPSVehicle tracking system using GSM and GPS
Vehicle tracking system using GSM and GPS
 

Similar to Interface gsm module with pic

CC2500 Wireless Trans-receiver Module
CC2500 Wireless Trans-receiver ModuleCC2500 Wireless Trans-receiver Module
CC2500 Wireless Trans-receiver ModuleAarya Technologies
 
IRJET- Design and Implementation of Telemetry Encoder for Light- Weight Ballo...
IRJET- Design and Implementation of Telemetry Encoder for Light- Weight Ballo...IRJET- Design and Implementation of Telemetry Encoder for Light- Weight Ballo...
IRJET- Design and Implementation of Telemetry Encoder for Light- Weight Ballo...IRJET Journal
 
REAL-TIME VEHICLE LOCKING AND TRACKING SYSTEM USING GSM AND GPS TECHNOLOGY-A...
REAL-TIME VEHICLE  LOCKING AND TRACKING SYSTEM USING GSM AND GPS TECHNOLOGY-A...REAL-TIME VEHICLE  LOCKING AND TRACKING SYSTEM USING GSM AND GPS TECHNOLOGY-A...
REAL-TIME VEHICLE LOCKING AND TRACKING SYSTEM USING GSM AND GPS TECHNOLOGY-A...Sandeep Kunsoth
 
Auto dial-er Home security
Auto dial-er Home securityAuto dial-er Home security
Auto dial-er Home securityvaibhav jindal
 
E notice board project report
E notice board project reportE notice board project report
E notice board project reportamit chaudhary
 
GSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLER
GSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLERGSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLER
GSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLERMd. Moktarul Islam
 
gsm based led scrolling board ppt
gsm based led scrolling board pptgsm based led scrolling board ppt
gsm based led scrolling board pptsodabathula gandhi
 
P 6168--microcontroller based-lpg_gas_detector_using_gsm_module
P 6168--microcontroller based-lpg_gas_detector_using_gsm_moduleP 6168--microcontroller based-lpg_gas_detector_using_gsm_module
P 6168--microcontroller based-lpg_gas_detector_using_gsm_moduleChitrachedu Dada Kalandar
 
GSM Based Campus Display system
GSM Based Campus Display systemGSM Based Campus Display system
GSM Based Campus Display systemKashyap Shah
 
Implementation of MIL-STD1553 using Microcontroller Atmega 328P
Implementation of MIL-STD1553 using Microcontroller Atmega 328PImplementation of MIL-STD1553 using Microcontroller Atmega 328P
Implementation of MIL-STD1553 using Microcontroller Atmega 328PIRJET Journal
 
Embedded system lab work
Embedded system lab workEmbedded system lab work
Embedded system lab workJIGAR MAKHIJA
 
PIC18F458_Ritula Thakur.pptx.pdf
PIC18F458_Ritula Thakur.pptx.pdfPIC18F458_Ritula Thakur.pptx.pdf
PIC18F458_Ritula Thakur.pptx.pdfAvinashJain66
 
Coral gsm cdma gateway
Coral gsm cdma gatewayCoral gsm cdma gateway
Coral gsm cdma gatewayMohd Arif
 
Home automation and securty using wireless networks
Home automation and securty using wireless networksHome automation and securty using wireless networks
Home automation and securty using wireless networksArun Kumar
 
gsm based Notice board
gsm based Notice boardgsm based Notice board
gsm based Notice boardASHIRVAD KUMAR
 
1 PageAlarm Clock Design Using PIC18F45E.docx
1  PageAlarm Clock Design Using PIC18F45E.docx1  PageAlarm Clock Design Using PIC18F45E.docx
1 PageAlarm Clock Design Using PIC18F45E.docxmercysuttle
 

Similar to Interface gsm module with pic (20)

G3602050055
G3602050055G3602050055
G3602050055
 
Vehicle tracting system
Vehicle tracting systemVehicle tracting system
Vehicle tracting system
 
Product catlog
Product catlogProduct catlog
Product catlog
 
CC2500 Wireless Trans-receiver Module
CC2500 Wireless Trans-receiver ModuleCC2500 Wireless Trans-receiver Module
CC2500 Wireless Trans-receiver Module
 
IRJET- Design and Implementation of Telemetry Encoder for Light- Weight Ballo...
IRJET- Design and Implementation of Telemetry Encoder for Light- Weight Ballo...IRJET- Design and Implementation of Telemetry Encoder for Light- Weight Ballo...
IRJET- Design and Implementation of Telemetry Encoder for Light- Weight Ballo...
 
REAL-TIME VEHICLE LOCKING AND TRACKING SYSTEM USING GSM AND GPS TECHNOLOGY-A...
REAL-TIME VEHICLE  LOCKING AND TRACKING SYSTEM USING GSM AND GPS TECHNOLOGY-A...REAL-TIME VEHICLE  LOCKING AND TRACKING SYSTEM USING GSM AND GPS TECHNOLOGY-A...
REAL-TIME VEHICLE LOCKING AND TRACKING SYSTEM USING GSM AND GPS TECHNOLOGY-A...
 
Auto dial-er Home security
Auto dial-er Home securityAuto dial-er Home security
Auto dial-er Home security
 
E notice board project report
E notice board project reportE notice board project report
E notice board project report
 
GSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLER
GSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLERGSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLER
GSM 1308 MODEM CONTROL USING PIC-16F877A MICROCONTROLLER
 
gsm based led scrolling board ppt
gsm based led scrolling board pptgsm based led scrolling board ppt
gsm based led scrolling board ppt
 
CHAPTERS
CHAPTERSCHAPTERS
CHAPTERS
 
P 6168--microcontroller based-lpg_gas_detector_using_gsm_module
P 6168--microcontroller based-lpg_gas_detector_using_gsm_moduleP 6168--microcontroller based-lpg_gas_detector_using_gsm_module
P 6168--microcontroller based-lpg_gas_detector_using_gsm_module
 
GSM Based Campus Display system
GSM Based Campus Display systemGSM Based Campus Display system
GSM Based Campus Display system
 
Implementation of MIL-STD1553 using Microcontroller Atmega 328P
Implementation of MIL-STD1553 using Microcontroller Atmega 328PImplementation of MIL-STD1553 using Microcontroller Atmega 328P
Implementation of MIL-STD1553 using Microcontroller Atmega 328P
 
Embedded system lab work
Embedded system lab workEmbedded system lab work
Embedded system lab work
 
PIC18F458_Ritula Thakur.pptx.pdf
PIC18F458_Ritula Thakur.pptx.pdfPIC18F458_Ritula Thakur.pptx.pdf
PIC18F458_Ritula Thakur.pptx.pdf
 
Coral gsm cdma gateway
Coral gsm cdma gatewayCoral gsm cdma gateway
Coral gsm cdma gateway
 
Home automation and securty using wireless networks
Home automation and securty using wireless networksHome automation and securty using wireless networks
Home automation and securty using wireless networks
 
gsm based Notice board
gsm based Notice boardgsm based Notice board
gsm based Notice board
 
1 PageAlarm Clock Design Using PIC18F45E.docx
1  PageAlarm Clock Design Using PIC18F45E.docx1  PageAlarm Clock Design Using PIC18F45E.docx
1 PageAlarm Clock Design Using PIC18F45E.docx
 

Recently uploaded

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLManishPatel169454
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 

Recently uploaded (20)

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 

Interface gsm module with pic

  • 1. Interface GSM module with PIC.. The Global System for Mobile (GSM) communication is the Second Generation of mobile technology. Although the world is moving towards Third and Fourth generation but GSM has been the most successful and widespread technology in the communication sector. GSM technology paved a new way for mobile communication. This project explains the interfacing of a GSM Module with a PIC microcontroller. It also covers a way to dial a particular GSM mobile number as well as send a message to it using AT Commands with the help of PIC18F4550. Objectives: This project has following objectives which are fulfilled using AT Commands: 1. Test the simple AT Command. 2. Find out the IMEI number of the GSM Modem. 3. Connect a call to a GSM mobile number (Dial a number). 4. Send a text message to a mobile number. The provision of these four operations has been provided by means of four tactile switches. Each switch corresponds to each of the above functions. AT Commands used to perform the above operations have been given below along with their output. (For complete list of AT Commands supported by GSM Modem, refer the list in tutorial on AT Commands. As explained earlier (refer GSM interfacing with 8051), a line converter MAX232 is employed to convert the RS232 logic data of GSM Module to TTL logic so that it can be processed by the microcontroller. In this project, instead of RS232 logic data, TTL logic output has been taken and thus PIC18F4550 has been directly connected with GSM Modem without any line converter in between. The following diagram shows the TTL input and output of GSM modem used.
  • 2. Code:- //Program to interface GSM Modem with PIC18F4550 Microcontroller //This code takes four choices as four inputs //Choice 1 : Test the simple AT Command. //Choice 2 : Find out the IMEI number of the GSM Modem. //Choice 3 : Connect a call to a GSM mobile number. //Choice 4 : Send a text message to a mobile number. #define FREQ 12000000 #define baud 9600
  • 3. #define spbrg_value (((FREQ/64)/baud)-1) #define rs LATA.F0 #define rw LATA.F1 #define en LATA.F2 #define lcdport LATB void tx_data(unsigned char); unsigned char rx_data(); void lcd_ini(); void lcdcmd(unsigned char); void lcddata(unsigned char); void gsm_cmd(unsigned char *); void output(void); unsigned char value=0; int i=0,j,k,temp,flag,choice; unsigned char *starting_text="Enter choice="; unsigned char *dial_text="Dialing..."; unsigned char *at_cmd="AT"; unsigned char *imei_cmd="AT+GSN"; unsigned char *call_cmd="ATD9xxxxxxxxx;"; // Provide a 10-Digit Mobile Number unsigned char *sms_format="AT+CMGF=1"; unsigned char *sms_write="AT+CMGS="xxxxxxxxxx""; // 10-Digit Mobile Number unsigned char *sms="Hello"; unsigned char *sms_report="SMS Sent..."; unsigned char sms_terminate=0x1A; unsigned char enter=0x0D; unsigned char *data; void main() { TRISB=0; // Set Port B as output port LATB=0; TRISA=0; LATA=0; TRISD=0xFF; LATD=0; SPBRG=spbrg_value; // Fill SPBRG register to set the baud rate RCSTA.SPEN=1; // To activate serial port (Tx and Rx pins) TXSTA.TXEN=1; // Activate Transmissiom RCSTA.CREN=1; // Activate Reception PIE1.RCIE=1; // Enable Reception interrupt INTCON.GIE=1; // Enable Global interrupt INTCON.PEIE=1; // Enable Peripheral interrupt lcd_ini(); while(1) { k=0; lcdcmd(0x80); while(starting_text[k]!='0') { lcddata(starting_text[k]);
  • 4. k++; } //Check inputs //Choice 1 if(PORTD.F0) { gsm_cmd(at_cmd); output(); Delay_ms(1000); } //Choice 2 if(PORTD.F1) { gsm_cmd(imei_cmd); output(); Delay_ms(1000); } //Choice 3 if(PORTD.F2) { gsm_cmd(call_cmd); output(); Delay_ms(1000); } //Choice 4 if(PORTD.F3) { gsm_cmd(sms_format); output(); Delay_ms(1000); gsm_cmd(sms_write); output(); Delay_ms(1000); gsm_cmd(sms); output(); tx_data(0x1A); Delay_ms(1000); } } } void gsm_cmd(unsigned char *string) { i=0;j=0; while(string[i]!='0')
  • 5. { temp=0; if(string[i]==0x5C) // Not to send '' cahracter i++; tx_data(string[i]); // Send by serial communication i++; while(temp!=1); } temp=0; tx_data(enter); // Send ASCII code for 'Enter' key while(temp!=1); } void output(void) // To print data on LCD { lcdcmd(0x01); i=-1;flag=0; while(i<j) { if(flag>1) { flag=0; Delay_ms(500); lcdcmd(0x01); lcdcmd(0x80); } if(data[i]==0x0A) // This condition is to avoid double Enter // during execution of a command { flag++; lcdcmd(0xc0); } if(data[i]=='>'||data[i]=='"') // Not to print this character { i++; lcdcmd(0xc0); } if(data[i]!=0x0D&&data[i]!=0x0A&&data[i]!=0x1A) // Condition to print the data // except 'Enter','New line' and 'Submit' { lcddata(data[i]); i++; } else i++; Delay_ms(300); } lcdcmd(0x01); }
  • 6. void tx_data(unsigned char serial_data) // Transmit data function { TXREG=serial_data; while(PIR1.TXIF==0); } void interrupt() { data[j]=RCREG; // Store the data into array when Reception interrupt occurs value=RCREG; j++; temp=1; } void lcd_ini() { lcdcmd(0x38); // Configure the LCD in 8-bit mode, 2 line and 5x7 font lcdcmd(0x0C); // Display On and Cursor Off lcdcmd(0x01); // Clear display screen lcdcmd(0x06); // Increment cursor lcdcmd(0x80); // Set cursor position to 1st line, 1st column } void lcdcmd(unsigned char cmdout) { lcdport=cmdout; //Send command to lcdport=PORTB rs=0; rw=0; en=1; Delay_ms(10); en=0; } void lcddata(unsigned char dataout) { lcdport=dataout; //Send data to lcdport=PORTB rs=1; rw=0; en=1; Delay_ms(10); en=0; }