0% found this document useful (0 votes)
10 views3 pages

C Prog Sms

The document details a C program to send SMS messages from a GSM module. It includes functions for initializing the UART and GSM modules, sending characters and strings, and a main function that calls the other functions to send a test SMS message.

Uploaded by

ppat2006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

C Prog Sms

The document details a C program to send SMS messages from a GSM module. It includes functions for initializing the UART and GSM modules, sending characters and strings, and a main function that calls the other functions to send a test SMS message.

Uploaded by

ppat2006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Aim: Develop a program in C to read and send SMS from the GSM module.

Theory:
Program:
#include<reg51.h>void send_str(unsigned char *number=”766355334”;
void send_syr(unsigned char str);
void send
void uart_init();
void gsm_init();
void sendsms();
void delay(unsigned int itime);
void main()
{
Uart_init();
gsm_init();
sendsms();
while(1);
}
void delay(unsigned int itime)
{
int i,j;
for(i=0;i<itime;i++);
for(j=0;j<120;j++);
}
void uart_init()
{
SCON=0x50;
TMOD=0x20;
TH1=0xFD;
TR1=1;
}
void gsm_init()
{
send_str(“ATE0”);
send_char(0x0D);
delay(100);
send_str(“AT+IPR=9600”);
send_char(0x0D);
delay(100);
send_str(“AT”);
send_char(0x0D);
delay(100);
}
void send_char(unsigned char chr)
{
SBUF=chr;
while(TI==0)
TI=0;
}
void send_str(unsigned char *str)
{
while(str)
{
Send_char(*str++);
}
}
void sendsms()
{
send_str(“AT+CMGF=1”);
send_char(0x0D);
delay(200);
send_str(“AT+CMGS=”);
send_char(0x22);
send_str(number);
send_char(0x022);
send_char(0x0D);
delay(1000);
send_str(“test message 8051 GSM”);
send_char(0x1A);
delay(500);
}

Conclusion: Hence studied the experiment to send and read sms from GSM module.

You might also like