Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PLZ I need this Code Urgently

Status
Not open for further replies.

cool_guy4ever15

Newbie level 5
Joined
Mar 11, 2009
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,338
2313def.dat

Hello Every Body

my graduation project is SMS Remote COntrol,i'm using t290i ericsson i've tested it with AT Commands and hyper terminal it works well when i send message to mobile i could read it on hyperterminal.but now i don't know how can i make the MCU when i connect it to the mobile recieve the msg an switch on/off devices.

plz i want the full code so i can burn it. may be i'll connect devices on port2 p2.0 ...p2.4. assume any port NOP but tell me.

plz i want this code as soon as possible.
 

Hi,
Tell me which MCU you have to use this project????? After that I'll give you solution for that.

Regards,
Anand.A
 

i am not expert in programming C for Microcontroller. and i don't think it'll be a problem that any one helps me in the project.as i see many ppl in the forum writing codes for each other.

and for Mr.aanand_44 i'm using AT89s52.thanks for your help. i'll be waiting the code plz. and if u want me to explain to you any information about the code which pins i connect the device to and the switch on/off messages.
 

Maybe he was forced or maybe, just maybe he didn't want to do your homework.
 

Connect Your mobile or your GSM modem to serial port of your uC!
This is code you asked, you can Send & Receive SMS using this code.
You can find this code is Sample folder of your BASCOM too...
Hope to help!
Regards,
Shahram H.Farmanesh


'------------------------------------------------------------------------------
' SMS.BAS
' (c) 2002-2007 MCS Electronics
' This sample shows how to use AT command on a GSM mode
' The GSM modems are available from www.mcselec.com
'------------------------------------------------------------------------------

$regfile = "2313def.dat"

'XTAL = 10 MHZ
$crystal = 10000000

'By default the modem works at 9600 baud
$baud = 9600

'HW stack 20, SW stack 8 , frame 10
$hwstack = 20
$swstack = 8
$framesize = 8


'some subroutines
Declare Sub Getline(s As String)
Declare Sub Flushbuf()
Declare Sub Showsms(s As String )


'used variables
Dim I As Byte , B As Byte
Dim Sret As String * 66 , Stemp As String * 6

'we use a serial input buffer
Config Serialin = Buffered , Size = 12 ' buffer is small a bigger chip would allow a bigger buffer

'enable the interrupts because the serial input buffer works interrupts driven
Enable Interrupts

'define a constant to enable LCD feedback
Const Uselcd = 1
Const Senddemo = 1 ' 1= send an sms
Const Pincode = "AT+CPIN=1234" ' pincode change it into yours!
Const Phonenumber = "AT+CMGS=+31653123456" ' phonenumber to send sms to

#if Uselcd = 1
Cls
Lcd "SMS Demo"
#endif

'wait until the mode is ready after power up
Waitms 3000

#if Uselcd = 1
Lcd "Init modem"
#endif


Print "AT" ' send AT command twice to activate the modem
Print "AT"
Flushbuf ' flush the buffer
Print "ATE0"
#if Uselcd = 1
Home Lower
#endif

Do
Print "AT" : ' Waitms 100
Getline Sret ' get data from modem
#if Uselcd = 1
Lcd Sret ' feedback on display
#endif
Loop Until Sret = "OK" ' modem must send OK
Flushbuf ' flush the input buffer
#if Uselcd = 1
Home Upper : Lcd "Get pin mode"
#endif
Print "AT+cpin?" ' get pin status
Getline Sret
#if Uselcd = 1
Home Lower : Lcd Sret
#endif
If Sret = "+CPIN: SIM PIN" Then
Print Pincode ' send pincode
End If
Flushbuf
#if Uselcd = 1
Home Upper : Lcd "set text mode"
#endif
Print "AT+CMGF=1" ' set SMS text mode
Getline Sret ' get OK status
#if Uselcd = 1
Home Lower : Lcd Sret
#endif

'sms settings
Print "AT+CSMP=17,167,0,0"
Getline Sret
Print "AT+CNMI=0,1,2,0,0"
Getline Sret

#if Senddemo = 1
#if Uselcd = 1
Home Upper : Lcd "send sms"
#endif
Print Phonenumber
Waitms 100
Print "BASCOM AVR SMS" ; Chr(26)
Getline Sret
#if Uselcd = 1
Home Lower : Lcd Sret 'feedback
#endif
#endif


'main loop
Do
Getline Sret ' wait for a modem response
#if Uselcd = 1
Cls
Lcd "Msg from modem"
Home Lower : Lcd Sret
#endif
I = Instr(sret , ":") ' look for :
If I > 0 Then 'found it
Stemp = Left(sret , I)
Select Case Stemp
Case "+CMTI:" : Showsms Sret ' we received an SMS
' hanle other cases here
End Select
End If
Loop ' for ever


'subroutine that is called when a sms is received
's hold the received string
'+CMTI: "SM",5
Sub Showsms(s As String )
#if Uselcd = 1
Cls
#endif
I = Instr(s , ",") ' find comma
I = I + 1
Stemp = Mid(s , I) ' s now holds the index number
#if Uselcd = 1
Lcd "get " ; Stemp
Waitms 1000 'time to read the lcd
#endif

Print "AT+CMGR=" ; Stemp ' get the message
Getline S ' header +CMGR: "REC READ","+316xxxxxxxx",,"02/04/05,01:42:49+00"
#if Uselcd = 1
Lowerline
Lcd S
#endif
Do
Getline S ' get data from buffer
Select Case S
Case "PORT" : 'when you send PORT as sms text, this will be executed
#if Uselcd = 1
Cls : Lcd "do something!"
#endif
Case "OK" : Exit Do ' end of message
Case Else
End Select
Loop
#if Uselcd = 1
Home Lower : Lcd "remove sms"
#endif
Print "AT+CMGD=" ; Stemp ' delete the message
Getline S ' get OK
#if Uselcd = 1
Lcd S
#endif
End Sub


'get line of data from buffer
Sub Getline(s As String)
S = ""
Do
B = Inkey()
Select Case B
Case 0 'nothing
Case 13 ' we do not need this one
Case 10 : If S <> "" Then Exit Do ' if we have received something
Case Else
S = S + Chr(b) ' build string
End Select
Loop
End Sub

'flush input buffer
Sub Flushbuf()
Waitms 100 'give some time to get data if it is there
Do
B = Inkey() ' flush buffer
Loop Until B = 0
End Sub
 
thank u mr zahak i really really approtiate your help

and for u mr. RBB i don't want some one to do my job coz am lazy NO But i want so because i don't know programming language especially MicroC and am newBie so if i learn to program this code i'll be running out of time ...

thank you again mr.zahak i really approtiate your work and i'll test it and tell you the results
 

Dears
I connect sim 300 to avr microcontroller and connect one LCD to microcontroller.How can I process received SMS. For example how can I indicate received SMS on LCD.please note that I will use codevision . please inform sample code if you have.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top