HowtoInterfaceGSMwith8051
MemberLogin
|
AboutUs
|
BecomeaMember
|
ContactUs
|
Dealership
Search
Home
Products
ProjectKits
Components
Articles
Customers
Forum
Blog
Jobs
Training
MicrocontrollerBoards
CPLD/FPGABoards
DSP
Sensors
RaspberryPi&Accessories
0
HowtoInterfaceGSMwith8051
InterfacingGSMwith8051
Tags:Schematicstointerfacem10gsmwith8051,cprogramtosendandreceivesmsusing8051,send
smsusinggsmmodem,lowcostgsmmodem,CircuitDiagramtoInterfaceGSMwithLPC2148,gsm
sourcecode,m10atcommands,
Ratethis(Logintoaddarating)
Overallrating
8051PrimerBoard
https://www.pantechsolutions.net/projectkits/interfacinggsmwith8051primer
1/8
11/3/2015
HowtoInterfaceGSMwith8051
The8051Primerboardisspecificallydesignedtohelpstudentsto
mastertherequiredskillsintheareaofembeddedsystems.Thekitis
designedinsuchwaythatallthepossiblefeaturesofthemicrocontroller
willbeeasilyusedbythestudents.Thekitsupportsinsystem
programming(ISP)whichisdonethroughserialport.
NXPs8051(89V51RD2),8051PrimerKitisproposedtosmooththe
progressofdevelopinganddebuggingofvariousdesignsencompassing
ofHighspeed8bitMicrocontrollers.
GSM(GlobalSystemforMobileCommunication)
GSMisadigitalmobiletelephonysystem.GSMdigitizesand
compressesdata,thensendsitdownachannelwithtwootherstreamsof
userdata,eachinitsowntimeslot.Itoperatesateitherthe900MHzor1800MHzfrequencyband.
InterfacingGSM
Fig.1showshowtointerfacetheGSMwithmicrocontroller.TheGSMmoduleiscommunicatethe
microcontrollerwithmobilephonesthroughUART.TocommunicateoverUARTorUSART,wejust
needthreebasicsignalswhicharenamely,RXD(receive),TXD(transmit),GND(commonground).
GSMmodeminterfacingwithmicrocontrollerforSMScontrolofindustrialequipments.ThesendingSMS
throughGSMmodemwheninterfacedwithmicrocontrollerorPCismuchsimplerascomparedwith
sendingSMSthroughUART.
Textmessagemaybesentthroughthemodembyinterfacingonlythreesignalsoftheserialinterfaceof
modemwithmicrocontrolleri.e.,TxD,RxDandGND.InthisschemeRTSandCTSsignalsofserialport
interfaceofGSMModemareconnectedwitheachother.
Thetransmitsignalofserialportofmicrocontrollerisconnectedwithtransmitsignal(TxD)oftheserial
interfaceofGSMModemwhilereceivesignalofmicrocontrollerserialportisconnectedwithreceive
signal(RxD)ofserialinterfaceofGSMModem.
TheSMSmessageintextmodecancontainonly140charactersatthemost.Itdependsupontheamountof
informationcollectedfromGPSEnginethatyouneedatthebasestationfortrackingvehicleorperson.
https://www.pantechsolutions.net/projectkits/interfacinggsmwith8051primer
2/8
11/3/2015
HowtoInterfaceGSMwith8051
Fig.1InterfacingUARTtoMicrocontroller
InterfacingGSMwith8051
Wenowwanttodisplayatextinmobilefrom8051PrimerBoardbyusingGSMmodulethroughUART.
In8051PrimerBoardcontainstwoserialinterfacesthatareUART0&UART1.Hereweareusing
UART0.TheGSMmodemisbeinginterfacedwiththemicrocontroller8051PrimerBoardforSMS
communication.TheSMScanbesendingandreceivingforthedatasharingandsituationinformationand
control.
PinAssignmentwith8051
CircuitDiagramtoInterfaceGSMwith8051
https://www.pantechsolutions.net/projectkits/interfacinggsmwith8051primer
3/8
11/3/2015
HowtoInterfaceGSMwith8051
SourceCode
TheInterfacingGSMmodulewith8051programisverysimpleandstraightforward,whichsenda
messagetomobilesfrom8051PrimerBoardthroughGSMmodulebyusingUART0.Somedelayis
occurringwhenasingledataissenttomobilethroughUART.CprogramsarewritteninKeilsoftware.
Thebaudrateofmicrocontrolleris9600.
CProgramtosendamessagefrom8051
***************************************************************************************
Title:Programtosendamessagefrom8051tomobilethroughGSM
***************************************************************************************
#include<REG51.H>/*specialfunctionregisterdeclarations*/
#include<stdio.h>/*prototypedeclarationsforI/Ofunctions*/
#defineLEDP0//defineprotP0forLED
voidserial_init(void)
unsignedintj
//Setuptheserialportfor9600baudat11.0592MHz.
//
voidserial_init(void)
{
https://www.pantechsolutions.net/projectkits/interfacinggsmwith8051primer
4/8
11/3/2015
HowtoInterfaceGSMwith8051
SCON=0x50/*SCON:mode1,8bitUART,enable
rcvr*/
TMOD|=0x20/*TMOD:timer1,mode2,8bitreload
*/
TH1=0xFD/*TH1:reloadvaluefor9600baud@
11.0592MHz*/
TR1=1/*TR1:timer1run*/
TI=1/*TI:setTItosendfirstcharofUART*/
}
//DelayRoutinestarthere
voiddelay1(intn)
{
inti
for(i=0i<ni++)
}
voiddelay2(intn)
{
inti
for(i=0i<ni++)
delay1(1000)
}
voidled_left()
{
for(j=0x01j<=0x80j<<=1)
{
LED=j
delay1(1000)
}
}
//
//Mainprogramstartshere
//
voidmain(void)
{
serial_init()
//serialinitialization
LED=0x00
printf("AT+CMGF=1%c",13)delay2(20)
//TextMode|hexvalueof13is0x0D(CR)
printf("AT+CMGS=\"9600292363\"%c",13)delay2(20)
//TypeyourmobilenumberEg:"9884467058"
led_left()//scrollleft
delay1(20)
printf("Hi:)GSMModemTest")delay2(20)//Type
textasuwant
printf("%c",0x1A)
https://www.pantechsolutions.net/projectkits/interfacinggsmwith8051primer
5/8
11/3/2015
HowtoInterfaceGSMwith8051
delay2(20)//linefeedcommand
while(1)
}
TocompiletheaboveCcodeyouneedtheKEILsoftware.Theymustbeproperlysetupandaprojectwith
correctsettingsmustbecreatedinordertocompilethecode.Tocompiletheabovecode,theCfilemust
beaddedtotheproject.
InKeil,youwanttodevelopordebugtheprojectwithoutanyhardwaresetup.Youmustcompilethecode
forgeneratingHEXfile.IndebuggingMode,youwanttochecktheportoutputwithout8051Primer
Board.
TheFlashMagicsoftwareisusedtodownloadthehexfileintoyourmicrocontrollerIC8051through
UART0.
TestingtheGSMwith8051
Give+5Vpowersupplyto8051PrimerBoardconnectthe+9VadapterwithGSMmodulewhichis
connectedwith8051PrimerBoardthroughUART0.OpentheHyperTerminalscreen,selectwhichport
youareusingandsetthedefaultsettings.Nowthescreenshouldshowsometextmessages.
ThefollowingCommandsandsequenceofeventsperformedforsendingtextmessagetoamobilephone
throughGSMModeminterfacedwithmicrocontroller:
FirstselectthetextmodeforSMSbysendingthefollowingATCommandtoGSMModem:
AT+CMGF=1.ThiscommandconfigurestheGSMmodemintextmode.
SendthefollowingATCommandforsendingSMSmessageintextmodealongwithmobilenumber
totheGSMModem:AT+CMGS=+923005281046.Thiscommandsendsthemobilenumberofthe
recipientmobiletotheGSMmodem.
Sendthetextmessagestring("GSMModemTest")totheGSMModemThisisatestmessagefrom
UART".
SendASCIIcodeforCTRL+Zi.e.,0x1AtoGSMModemtotransmitthemessagetomobilephone.
Aftermessagestringhasbeensenttothemodem,sendCTRL+Ztothemicrocontroller,whichis
equivalentto0x1A(ASCIIvalue).
IfyounotreadinganytextfromUART0,thenyoujustcheckthejumperconnections&justcheckthe
serialcableisworking.OtherwiseyoujustcheckthecodewithdebuggingmodeinKeil.Ifyouwanttosee
moredetailsaboutdebuggingjustseethevideosinbelowlink.
HowtoCreate&DebugaProjectinKeil.
GeneralInformation
https://www.pantechsolutions.net/projectkits/interfacinggsmwith8051primer
6/8
11/3/2015
HowtoInterfaceGSMwith8051
ForproperworkingusethecomponentsofexactvaluesasshowninCircuitfile.Whereverpossible
usenewcomponents.
Soldereverythinginacleanway.Amajorproblemarisesduetoimpropersoldering,solderjumps
andloosejoints.
Usetheexactvaluecrystalshowninschematic.
Moreinstructionsareavailableinfollowingarticles,
UserManualof8051PrimerBoard.
Tutorialofhowtocreate&DebugaprojectinKEIL.
HowtoInterfaceGSMwithLPC2148
JointheWorld'sLargestTechnicalCommunity
SignUp
werespectyourprivacy.
StayConnected...Followus!
Resources
Blog
Videos
Presentations
BuyingGuides
Newsletters
AcrosstheWeb
Twitter
Facebook
Linkedin
Google+
YouTube
Slideshare
Scribd
Stumbleupon
Pinterest
MoreInformation
WarrantyInformation
ReturnPolicy
CancellationOrder
https://www.pantechsolutions.net/projectkits/interfacinggsmwith8051primer
7/8
11/3/2015
HowtoInterfaceGSMwith8051
Holidays
TermsforSoftwares
RoHS
Dealership
ShippingPolicy
Company
AboutUs
Termsofuse
Privacypolicy
Terms&Conditions
Careers
Events
SiteMap
Contactus
PantechProLabsTeam
CRMLogin
Copyright2015PantechProLabsIndiaPvtLtd
ContentonthissiteislicensedunderaCreativeCommonsAttributionNonCommercialNoDerivs3.0
UnportedLicense
https://www.pantechsolutions.net/projectkits/interfacinggsmwith8051primer
8/8