Upload
vivek2mb
View
2
Download
0
Embed Size (px)
DESCRIPTION
gsm to 89s52
Citation preview
Principle:
The main principle of this circuit is to interface a GSM modem with the
microcontroller. The microcontroller used is AT89C51 microcontroller. To
communicate with GSM modem, AT commands are required. Microcontroller sends
these commands to the GSM modem, which is then activated to perform the required
operation.
The following AT commands are frequently used to control the operations of GSM
modem.
Command – Operation
AT+CSMS – Select message service.
AT+CMGF – Message format.
AT+CMGL – List messages.
AT+CMGR – Read message.
AT+CMGS – Send message.
AT+CMGD – Delete message.
ATA – Answer a call.
ATD – Dial a number.
ATDL – Dial the last outgoing number.
ATH – Hang up the call.
GSM Modem Interfacing with 8051 Microcontroller Circuit Diagram:
Circuit Diagram of GSM Interfacing with 8051 Microcontroller
Circuit Components:
MAX232 IC.
AT89C51 microcontroller.
GSM modem.
Capacitors C1, C2, C3, C4, C5, C6.
Crystal oscillator.
Liquid crystal display.
Potentiometer.
#include /* special function register declarations */
include /* prototype declarations for I/O functions */
#define LED P0 //define prot P0 for LED void serial_init(void);
unsigned int j; //Setup the serial port for 9600 baud at 11.0592MHz.
//-------------------------------------------------
void serial_init(void) {
SCON = 0x50; /* SCON: mode 1, 8-bit UART, enable rcvr */
TMOD |= 0x20; /* TMOD: timer 1, mode 2, 8-bit reload */
TH1 = 0xFD; /* TH1: reload value for 9600 baud @ 11.0592MHz*/
TR1 = 1; /* TR1: timer 1 run */
TI = 1; /* TI: set TI to send first char of UART */
} //Delay Routine start here
void delay1(int n) {
int i; for(i=0;i
for(i=0;i<=0x80; j<<=1) { LED = j; delay1(1000); } } //------------------------------------- // Main program starts
here //------------------------------------- void main(void) { serial_init(); //serial initialization LED = 0x00;
printf("AT+CMGF=1%c",13); delay2(20); //Text Mode | hex value of 13 is 0x0D (CR )
printf("AT+CMGS=\"9600292363\"%c",13); delay2(20); //Type your mobile number Eg : "9884467058" led_left();
//scroll left delay1(20); printf("Hi :-) GSM Modem Test"); delay2(20); //Type text as u want printf("%c",0x1A);
delay2(20); //line feed command while(1); }