Вы находитесь на странице: 1из 16

3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

SENDMESSAGETHROUGHGSMMODULESIM300
15thFebruary2013
THOUGH8051FAMILYCONTROLLER

[http://3.bp.blogspot.com/IzUGokISYu0/UwhmCvvs2LI/AAAAAAAAADU/QcUBrF6cwU0/s1600/enjoy.jpg]

SOMEIMPORTANTPOINTSFORINTERFACING

1.OnethingalwaysrememberthathereinthisinterfacingthereisoneMAX232ICinbuiltinGSMMODULEbutyou
musthavetoputonemoreMAX232atthecontrollersidealso.

http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 1/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

2.IfyouarenotgoingtopurchasetheDB9MALETODB9FEMALECABLEthenjustbuymaleandfemalesocketand
connectthemassaidbelow

*ConnecttheotherendsofthewirestothepinsonthebackoftheDB9maleconnectorinthefollowingorder:

DB9malewirepin2toDB9femalepin3

DB9malewirepin3toDB9femalepin2

DB9malewirepin5toDB9femalepin5

leftrestofallthepinnonconnected

//==============================================================

CCODETOSENDMESSAGEONPARTICULARNUMBER

//==============================================================

#include<reg51.h>

voidserialcomm()
{

TMOD=0x20//Mode=2
TH1=0xfd//9600baud
SCON=0x50//Serialmode=1,8Bitdata,1Stopbit,1Startbit,Receivingon
TR1=1//Starttimer
}

voiddelay(unsignedintvalue)
{
unsignedinti,j
for(i=0i<valuei++)

http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 2/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

for(j=0j<1275j++)
}

voidserial(unsignedcharx)
{
SBUF=x
while(TI==0)
TI=0
}

voidSend2Gsm(char*aaa)
{
unsignedinti
for(i=0aaa[i]!=0i++)
{
serial(aaa[i])
}
}

voidmain()
{

serialcomm()

Send2Gsm("AT\r\n")
delay(2)

Send2Gsm("AT+CMGF=1\r\n")
delay(2)
http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 3/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

Send2Gsm("AT+CMGS=\"+9190163476\"\r\n")
delay(2)

Send2Gsm("hy")
serial(0x1a)

while(1)

Posted15thFebruary2013byyadavBrijesh

38 Viewcomments

yadavBrijesh 15February2013at03:14
ifanyonewantanythingregardinggsmmodulejustcommentyourproblems.......
Reply

Replies

sakshisinha 8May2014at06:07
We are working over the project named "sms based electronic notice board system".our gsm is not
receivingthemsgwersending...butitsdisplayingwatevaithasonlcd..cnuhelpus?

milesanmama 20May2014at09:28
checkthegsmmoduleusingpccomportwhileitsworkingornot.....

ArnavBelapurkar 9February2015at18:16
http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 4/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

@yadav brijesh and sakshi sinha:i m also working in the same project 'GSM BASED ELECTRONIC
NOTICE BOARD'..but i m unable to find config. for connecting 5*7 dotmatrix led modules in
series...moreover i m a novice in 8051 programming and gsm ...so i desparately need help....u can feel
freetoemailmeorreplyhere...myemailidisarnavbelapurkar@gmail.com...otherswhocanhelpcanalso
emailme

Reply

RamtejaAyyagari 23February2013at22:05
Ineedtointerface89s52vthsim300willdcoderemainsamerelseanychangeplshelpme
Reply

Replies

yadavBrijesh 24February2013at06:48
yesifyouwanttointerfaceanykindof8051familycontrollerthecodingremainsame

soinyourcasealsothecodingwillremainsame
ifuwantanykindofhelpjustcommentoverhere......

ram 1March2013at04:29
thnkusonmuchforurrply...
douhavanyideaaboutgpsinterfacingwithmicrocontroller????ineedtheinterfacingandcodeboth

yadavBrijesh 2March2013at20:55
ifuhavegpsmodulethnuseserialcomm.codingforthatalsoandcheckoutputinthehyperterminaloron
lcd

yadavBrijesh 2March2013at21:04
butonethingrememberthatgpsgivesudatasowritethebelowcodeandenabletheserialcomm.intrrupt

//SerialInterruptFunction
//

http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 5/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

voidseril(void)interrupt4//SerialPortInterrupt
{
if(RI==1)//ReceiveInterruptGetsEnabled
{//afterStopBitgetReceived
r=SBUF//SerialBuffervaluemovedtoavariable
rx[j]=r
SBUF=rx[j]
delay(20)//DelayFunction
j++
}
SCON=0X50//InitialisingReceiveandTransmitInterrupt
}

thissubrutineuhavetoaddforreceptionofdatafromgps

RamtejaAyyagari 2March2013at22:12
my project is vehicle accident identification using gps and gsm i hope u got the idea how i'm going to
implementthissocanigetcodeforbothgpsngsmwithmicrocontroller.i'musingpushbuttonstosense
accidenti.e,wheneverpushbuttonsarepressedmcneedtoonnsendthelocationusinggsmsoplssend
theentirecodeplsplshelpme....

ramakrishnaraoAyyagari 21March2013at08:57
heyramtejaicanunderstandyourproblem
gpsgicesdifferentsetslikegprmcandgpggasoifyouwanttogetlocation
use$gprmc
maketwofunctionslikeheaderanddata
charFrame_Header_Seperation()
{
charidata*Frame_Header="\0"
i=0
while(i<6)
{
Frame_Header[i]=*(Frame+i)
i++
}

Frame_Header[i]='\0'
if(!(strcmp(Frame_Header,"$GPRMC")))
return1
else

http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 6/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

return0
}
voidFrame_Data_Seperation()
{
unsignedcharidataNo_Of_Camas=2,j=0,temp0=0
i=0
while((*(Frame+i++)!='\0')&&(No_Of_Camas!=0))
{
if((*(Frame+i++)==','))
No_Of_Camas
}
i
while(!No_Of_Camas)
{
if((*(Frame+i))==','&&temp0<2)
{
i++
i++
temp0++
}
Frame_Data_ToBeSend[j++]=*(Frame+i++)
if(temp0==2)
{
Frame_Data_ToBeSend[j]='\0'
break
thislogicmaybehelpfulforu

Reply

IndrajitPramanik 2March2013at10:37
Iaminterfacingsim300withat89s52inyourprogramyouhaveincludedreg51.hwherewillIfindit?
whatarethefunctionof
voiddelay(unsignedintvalue)
{
unsignedinti,j
for(i=0i<valuei++)
for(j=0j<1275j++)
}

voidserial(unsignedcharx)
http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 7/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

{
SBUF=x
while(TI==0)
TI=0
}

voidSend2Gsm(char*aaa)
{
unsignedinti
for(i=0aaa[i]!=0i++)
{
serial(aaa[i])
}
}

thesecodepleasehelp
Reply

yadavBrijesh 2March2013at20:47
uhavetojusteditincludereg52.hinplaceofreg51.hrestofthecodingwillremainsame...
Reply

IndrajitPramanik 4March2013at19:29
HowcanIcontrolanydriverattachedtomyat89s52byusingGSMwhatwillbethecode
Reply

yadavBrijesh 5March2013at22:27
whichkindofdriver?
ifurdriverrelatedtosoftwerethenjustdiableintrruptwhileworkingandafterthetaskcopletationenableitagain
Reply

RamtejaAyyagari 11March2013at06:11
howtoswitchonamicrocontrolleriamusingapushbuttonhowtoconnectthistomicrocontroller
http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 8/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

Reply

yadavBrijesh 13March2013at12:05
yesucanusepushbuttonalsooritdependuponhardware.controllerjustneed5V,howuprovide5Vtoitthatsyour
ownway....ucanalsousetransistorasaswitchtherearelotsofway...
Reply

IndrajitPramanik 21March2013at11:07
whilecompilingyourcodethereisanerrorofC231i.e.Thespecifiednameisalreadydefinedandcannotberedefined
Iamusingkeilforcoding,pleasehelp
Reply

IndrajitPramanik 13May2013at01:36
Ignoretheabovecommentsofmy

I am having problem with the code above the code is not working I wanted to ask you that is using max 232
compulsoryorwecandirectlyconnectthemodemTXandRXtothecontrollerRXandTXandifsohaveyoutested
thecodeabovebecozit'snotworkinginmyprojectpleasebekindenoughtoconsidermycase
Reply

yadavBrijesh 15May2013at08:14
inshortgsmmodulehaveinbuiltmax232andwehavetouseexternallymax232compulsory...
myabovecodeisrunningwell
ifuhaveanyqueryucan'tundestandjustcallon09016347670thisnumber...
Reply

mayurnagdeve 16May2013at20:28
I am doing a project 'vehicle theft detection using gps and gsm module in that i am sending the gps receiver data
throughgsmbutiamconfusedhowtodothat.canupleasehelpmeinccodeoratleastprovidethelogicbehindit.i
amusing8051uc.
Reply
http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 9/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

Replies

yadavBrijesh 17May2013at03:54
mayurnagdeve:yafirstuhavetoreceivethegpsdatawhichuhavetostoreinonearrayandthenafteru
cansendthatlocationusinggsmmodule.
butfirstuhavetoclearwithyourinterfacingdiagramaccordingtothatucanprogramming.

Reply

ATEET 7December2013at05:48
hello yadav,i want to send a message through gsm module. i want to know whether your code supports gsm
interfacingwithoutpc..?
Reply

pradeepc 14January2014at00:34
howwewillgetmessage...afterturnoncontroller...weget"hy"massagefromgsmmoduletomynumberright?
Reply

kunal 18February2014at11:35
Hello!
iLoadedyourcodeinmy8051andconnectedtogsmasyoumentionedbutiamnotreceivinganymessage
onothercellno.
isthiscodeistested?

iconnectedsim300modulefromlaptopandfiredcommandonhyperterminal,itwasworkingfine.

ialsowanttoaskyouthatinthesecommands:
Send2Gsm("AT\r\n")
Send2Gsm("AT+CMGF=1\r\n")
Send2Gsm("AT+CMGS=\"+919016347670\"\r\n")

youhaveused"\r\n"
aretheycorrectbecausewheniamfiringthesecommandsfromhyperterminaltheyareshowingmeerror.
andwheniamnotusingthese\r\ntheyareperfectlyrunninginhyperterminal

http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 10/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

iamnewbieandwantyourhelp
thankuinadvance
Reply

JayTrivedi 20February2014at06:14
Hi!
CanIhavetheinterfacecircuitofSim300and89c51?
Iamhavingsomedoubtsregardingmax232
Reply

RamKumar 27February2014at03:28
hiimstrugglingtointerfacethegpsdatatothegsmsim300throughmc8951ineedtogatherthegpsdataandsend
thisdatatothemobileasamessagethroughgsmifuhavingcodingrelatedtothisconcepthelpme!
Reply

GundaTarakeswararao 7March2014at04:16
sircouldyoupleasegetmesourcecodeinassemblylanguageforgsmtosendmessage?iamtryingtodoprojectin
keil uvision4 which is compatible of upto 2kb limited code size.so i had to write in assembly language which be of
morethan2kbsize..
Reply

Trench 11March2014at06:32
hello sir....ur post is very useful..but i have 1 doubt...can i connect rs232 port on gsm modem to rs232 port on my
developmentboardof8051microcontroller....thanksinadvance
Reply

NagarajManohar 19March2014at09:32
willuprovidemecodeforaccidentdetectionandantitheftusinggpsandgsmusing8051microcontroller
Reply

http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 11/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

YOGESH 26March2014at21:53
sircouldyoupleasegetmesourcecodeinassemblylanguageforgsmtosendmessage?
Reply

PauloVincius 11April2014at03:21
Ol quero fazer esse projeto usando um sim900 ele compatvel ele tem sada RX, TX. TTL 5V. GOSTARIA QUE
SEPOSSVELENVIAOCODIGOASSEMBLYTAMBM.
Reply

santhoshkumar 4May2014at11:53
codenotworking..

Reply

Replies

milesanmama 20May2014at09:26
codeisworking....butthereyouhavetomakeachange....
inthislineSend2Gsm("AT+CMGS=\"+919016347670\"\r\n")
youhavetoremovesemicolonthatpresentjustafterthephoneno
anditshouldbeSend2Gsm("AT+CMGS=\"+919016347670\"\r\n")

nowifitisnotworkingthentrytofindtheproblemthatisintheh/w.....

Reply

vasumuthu 14May2014at00:03
HI.....
I am using dspic30F2010 controller. I am sending AT commands from controller to gsm module. but i can't read the
reply'Ok'.EarlierihavesentfromhyperterminalgsmrepliesOkicansee.Nowwhattodo.....
Reply

http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 12/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

milesanmama 19May2014at03:14
sirimhavingproblemwiththeinterfacingofgsmmodulein8051....whenitrytosendcommandfrompcusingPuTTY
software it some time works(some time returns error instead of ok)... but when i connect it with 8051 it never
works....cananyonehelpmeplease..
Reply

anilgadiyar 2November2014at02:11
ineedacodeforcontrollingaledusingarelay.gsmshouldreceivecmdlike"ledon"andshouldturnonled.
sofarihavewritten....
#include/*specialfunctionregisterdeclarations*/
#include/*prototypedeclarationsforI/Ofunctions*/
//#include"industrial.h"//defineprotP0forLED
voidserial_init(void)
#defineportP1
#definedataportP0
sbitrs=port^2
sbitrw=port^1
sbiten=port^0
unsignedintj
//Setuptheserialportfor9600baudat11.0592MHz.
//
voidserial_init(void)
{
SCON=0x50/*SCON:mode1,8bitUART,enablercvr*/
TMOD=0x20/*TMOD:timer1,mode2,8bitreload*/
TH1=0xFD/*TH1:reloadvaluefor9600baud@11.0592MHz*/
TR1=1/*TR1:timer1run*/
TI=1/*TI:setTItosendfirstcharofUART*/
}

voiddelay(unsignedintmsec)//Functionfordelay
{
inti,j
for(i=0i<mseci++)
for(j=0j<1275j++)
}
//DelayRoutinestarthere
voiddelay1(intn)
{
inti
for(i=0i<ni++)

http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 13/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

voiddelay2(intn)
{
inti
for(i=0i<ni++)
delay1(1000)
}
voidlcd_cmd(unsignedcharitem)//FunctiontosendcommandonLCD
{
dataport=item
rs=0
rw=0
en=1
delay(1)
en=0
return
}

voidlcd_data(unsignedcharitem)//FunctiontodisplaycharacteronLCD
{
dataport=item
rs=1
rw=0
en=1
delay(1)
en=0
return
}

voidlcd_data_string(unsignedchar*str)//FunctiontodisplaystringonLCD
{
inti=0
while(str[i]!='\0')
{
lcd_data(str[i])
i++
delay(10)
}
return
}
voidlcd()
{
lcd_cmd(0x38)//Forusing8bit2rowLCD

http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 14/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

delay(5)
lcd_cmd(0x0F)//Fordisplayoncursorblinking
delay(5)
lcd_cmd(0x80)//SetthecursoronfirstpositionofLCD
delay(5)
}
unsignedchararr
//
//Mainprogramstartshere
//
voidmain(void)
{lcd()
serial_init()//serialinitialization
printf("AT%c",13)
lcd_data_string("gsminitialized")
delay1(20)
printf("ATe0%c",13)
delay1(20)
printf("AT&W%c",13)
delay1(20)
//lcd_cmd(arr)
//lcd_data(arr)
//lcd_data_string("arr")
printf("AT+CMGF=1%c",13)delay2(20)//TextMode|hexvalueof13is0x0D(CR)
printf("AT+CMGS=\"9845562989\"%c",13)delay2(20)//TypeyourmobilenumberEg:"9884467058"
//scrollleft
delay1(20)
printf("Hi:)GSMModemTest")
lcd_data_string("WELCOME")
lcd_cmd(0x01)
lcd_data_string("msgsent")
lcd_cmd(0x01)
/*lcd_data_string("waiting..formsg")
{

printf("AT+CMGF=1%c",13)//selecttextmodeforsms
delay1(10)

printf("AT+CNMI=2,1,0,0,0%c",13)//notificationofnewsms
delay1(10)
printf("AT+CMGR=1%c",13)//ATcommandtoreadsms
delay1(10)
lcd_cmd(0x01)
lcd_data_string("msgrecived")

http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 15/16
3/6/2015 SENDMESSAGETHROUGHGSMMODULESIM300THOUGH8051FAMILYCONTROLLER

while(1)
}*/delay2(20)//linefeedcommand

while(1)

plsemailmeurhelp...gadiyar.anil7@gmail.com
Reply

SaravananRaj 5March2015at04:05
connectinggsmandgpswith8051ispossible.thanksinadvance
Reply

Enteryourcomment...

Commentas: GoogleAccount

Publish
Preview

http://8051interfacingworld.blogspot.in/2013/02/sendmessagethroughgsmmodulesim300.html 16/16

Вам также может понравиться