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.

tc35 gsm modem related question

Status
Not open for further replies.
pdu sms status report length

Transmitter works OK. I have problem with receiver, so this wont solve my problem.
LP
 

c coad to sms gsm modem

C-Man said:
In theory it works like this:

You start having the complete PDU in a buffer (the pdu must already be in binary format that means "AABBCCDDEE" must equal to 0xAA, 0xBB, 0xCC, 0xDD, 0xEE).

Start by reading the first byte in the buffer (which is actually length of adress of SMSC) you add 2 to this value and use it as a pointer into the buffer (I assume the buffer starts at offset 0 as is usual in C).

Now the pointer points at lenght of destination adress.

You again read this byte add it to the pointer and finally add 9 (this skips protocol identifier, data coding scheme and timestamp.

Now the pointer must point to the lenght of userdata (which is counted in septets) when reading this value you should have your message lenght.

Please verify if everything is correct, I have only extracted this from my program ...

best regards

Sorry Mr C-Man cos am taking you back to year 2003 story when you ware talking about the sms controller with a pic

I tried to search the info about how to build such system but when i was examining the technical part especially on reading the sms from a modem/phone using AT protocal i found other says when you type with ericsson AT+CMGR=0
Phone reply like this +CMGR: 0,,26[CR][LF] 0791039624910000240C91xxxxxxxxxxxx00003001205151302108yyyyyyyyyyyyyy[CR][LF]
it is in PDU format and xxxxxxxxxxxxx is a sender number and yyyyyyyyyyyyy is a message contents

for you here u said You start having the complete PDU in a buffer (the pdu must already be in binary format that means "AABBCCDDEE" must equal to 0xAA, 0xBB, 0xCC, 0xDD, 0xEE)
so it look like it is similar story

Now
:arrow: i need to program PIC to read this string without taking the whole string to pic but only the interested part like sender number and the sms contents cos i need to verify the sender and to perform the command in sms content so is this string in PDU format similar to all other phone like Siemens you have used those days
:arrow: i don't know if for every sms in PDU the sender number and sms content are on the some position. Could you please let me know if the story above is true.
 

gsm modem built in logic

Hi
i found the link for PDU converter and i tested for different phone number and with different sms content so by analysing the PDU output i fond i can know by counting the alphanumeric digits at which digit the sender number start and the some for the sms contents but again i ask if AT+CMGR=0 is send to the modem it will start to reply with this string +CMGR: 0,,26[CR][LF] 07910 so how can i skip this +CMGR: 0,,26[CR][LF] and start counting the PDU contents?
and if i started to read the whole sting from the beginig of the PDU what will be the content of usart_read at first, will it be 0 or 07 and what will it contain for the second byte.
 

hi

sorry i am gonna ask question off the topic

i have Siemens TC35i having LPT port, how to connect this set with pc as a modem

as i dont have cable,

is there anyone having cable schematics for this phone or where to buy this cable?????
 

can anyone help me to combine these two programmes I want to read Gps data(latitude&longitude) and send with Gsm :
gps :
$regfile = "m16def.dat"
$crystal = 11059200
$baud = 9600
'-------------------------------------------------------------------------------
Config Lcd = 20 * 4
Cls
Cursor Off
'-------------------------------------------------------------------------------
Config Porta.1 = Output : Reset Porta.1
Config Portb.0 = Output : Led1 Alias Portb.0
'-------------------------------------------------------------------------------
Deflcdchar 0 , 7 , 5 , 7 , 32 , 32 , 32 , 32 , 32
'-------------------------------------------------------------------------------
On Urxc Rec_isr
Enable Urxc
Enable Interrupts
'-------------------------------------------------------------------------------
'GPS variables
Dim Urx_buff As String * 550
Dim Cnt As Word
Dim M As String * 5
Dim Gpgga As String * 80
Dim Gpvtg As String * 80
Dim Gpgga_flag As Bit
Dim Gpvtg_flag As Bit
Dim V_counter As Byte
Dim I As Byte
Dim L As Byte
Dim F_utc_time As Byte
Dim E_utc_time As Byte
Dim F_longitude As Byte
Dim E_longitude As Byte
Dim F_latitude As Byte
Dim E_latitude As Byte
Dim F_altitude As Byte
Dim E_altitude As Byte
Dim F_speed As Byte
Dim E_speed As Byte
Dim F_sat_num As Byte
Dim E_sat_num As Byte
Dim Utc_time As String * 10
Dim Utc_time_k As String * 10
Dim Longitude As String * 12
Dim Latitude As String * 12
Dim Altitude As String * 8
Dim Speed As String * 8
Dim Sat_num As String * 4
Dim Sat_inuse As Byte
Dim S_k1 As Single
Dim S_k2 As Single
Dim R_k1 As String * 15
Dim N As Byte
'-------------------------------------------------------------------------------
Locate 1 , 1 : Lcd "GPS"
Locate 2 , 1 : Lcd "connecting..."
Locate 3 , 1 : Lcd "Please wait..."

Do
'-------------------------------------------------------------------------------
If Cnt > 520 Then
Set Led1
Disable Urxc
Gosub Get_nmeapaket
Gosub Extract
Reset Led1
Urx_buff = ""
Cnt = 0
Enable Urxc
End If
'--------------------------------------------------
Loop
End
'-------------------------------------------------------------------------------
Get_nmeapaket:
For Cnt = 1 To 500
M = Mid(urx_buff , Cnt , 5)
If M = "GPGGA" Then
Gpgga = ""
V_counter = 0
Do
M = Mid(urx_buff , Cnt , 1)
Incr V_counter
Incr Cnt
Gpgga = Gpgga + M
Loop Until V_counter > 78 Or M = "*"
Exit For
End If
Next
For Cnt = 1 To 500
M = Mid(urx_buff , Cnt , 5)
If M = "GPVTG" Then
Gpvtg = ""
V_counter = 0
Do
M = Mid(urx_buff , Cnt , 1)
Incr V_counter
Incr Cnt
Gpvtg = Gpvtg + M
Loop Until V_counter > 78 Or M = "*"
Exit For
End If
Next
Urx_buff = ""
Cnt = 0
Return
'-------------------------------------------------------------------------------
Extract:
V_counter = 0
L = Len(gpgga)
For I = 1 To L
M = Mid(gpgga , I , 1)
If M = "," Then
Incr V_counter
If V_counter = 1 Then
F_utc_time = I + 1

Elseif V_counter = 2 Then
E_utc_time = I - F_utc_time
F_latitude = I + 1

Elseif V_counter = 3 Then
E_latitude = I - F_latitude

Elseif V_counter = 4 Then
F_longitude = I + 1

Elseif V_counter = 5 Then
E_longitude = I - F_longitude

Elseif V_counter = 7 Then
F_sat_num = I + 1

Elseif V_counter = 8 Then
E_sat_num = I - F_sat_num

Elseif V_counter = 9 Then
F_altitude = I + 1

Elseif V_counter = 10 Then
E_altitude = I - F_altitude
End If

End If
Next
Utc_time = Mid(gpgga , F_utc_time , E_utc_time) : Utc_time = Left(utc_time , 6)
Latitude = Mid(gpgga , F_latitude , E_latitude)
Longitude = Mid(gpgga , F_longitude , E_longitude)
Altitude = Mid(gpgga , F_altitude , E_altitude)
Sat_num = Mid(gpgga , F_sat_num , E_sat_num)

R_k1 = Left(latitude , 2)
S_k1 = Val(r_k1)
Latitude = Mid(latitude , 3 , 7)
S_k2 = Val(latitude)
S_k2 = S_k2 / 60
S_k2 = S_k2 + S_k1
Latitude = Fusing(s_k2 , "#.######")

R_k1 = Left(longitude , 3)
S_k1 = Val(r_k1)
Longitude = Mid(longitude , 4 , 7)
S_k2 = Val(longitude)
S_k2 = S_k2 / 60
S_k2 = S_k2 + S_k1
Longitude = Fusing(s_k2 , "#.######")
N = Val(sat_num)

If S_k2 <> 0 And N > 1 Then
Locate 1 , 1 : Lcd "Latitude=" ; Latitude ; Chr(0) ; " "
Locate 2 , 1 : Lcd "Longitud=" ; Longitude ; Chr(0) ; " "
Locate 3 , 1 : Lcd "Utc_time=" ; Utc_time
Locate 4 , 1 : Lcd "Altitud=" ; Altitude ; "m N=" ; Sat_num
End If
Return
'-------------------------------------------------------------------------------
Rec_isr:
Incr Cnt
Urx_buff = Urx_buff + Chr(udr)
Return








and GSM programme:




$regfile = "m16def.dat"
$crystal = 11059200
$baud = 9600
'$sim

Declare Sub Getline(s As String)
Declare Sub Flushbuf()
Declare Sub Showsms(s As String )


Dim I As Byte , B As Byte
Dim Sret As String * 200 , Stemp As String * 6 , W As Word
Dim S1 As String * 200 , S2 As String * 200



Ddrb.0 = 1
Ddrd.4 = 1

Config Lcdpin = Pin , Db4 = Pinc.4 , Db5 = Pinc.5 , Db6 = Pinc.6 , Db7 = Pinc.7 , E = Pinc.3 , Rs = Pinc.2
Config Lcd = 16 * 2

Cls
Home
Lcd "nEW"
'---------------------------------------------

Lowerline : Lcd "ON Process"
Toggle Portd.4
Portb.0 = 1
Wait 2
Toggle Portd.4
Portb.0 = 0
Wait 4
Toggle Portd.4
Portb.0 = 1
Wait 15
Toggle Portd.4

Print "AT" ; Chr(13)
Wait 1

Print "AT" ; Chr(13)
Wait 1

Print "AT" ; Chr(13)
Wait 1
Print "AT" ; Chr(13)
Wait 1
Print "AT" ; Chr(13)
Wait 1
Print "ATE0" ; Chr(13)
Wait 1



'----------------------------------------------
'sms settings

Cls : Home : Lcd "send sms"
Wait 1
Print "AT+CMGF=1" ; Chr(13)
Wait 1
Print "AT+CMGS=" ; Chr(34) ; "0913322222" ; Chr(34) ; Chr(13)
Wait 1
Print "SIM IS Restarted" ; Chr(26)
Lowerline : Lcd "sent sms1"
Getline Sret
Cls : Lowerline
Lcd Sret
Wait 4

Print "AT+CGATT=1" ; Chr(13)
Getline Sret
' get data from modem
Cls : Lowerline
Lcd Sret
Wait 4
Print "AT+CIPSTART=" ; Chr(34) ; "UDP" ; Chr(34) ; "," ; Chr(34) ; "91.98.32.182" ; Chr(34) ; "," ; Chr(34) ; "8830" ; Chr(34) ; Chr(13)
Getline Sret
Cls : Lowerline
Lcd Sret
Wait 4
Print "AT+CIPSEND" ; Chr(13)
Wait 1
Print Chr(01) ; Chr(02) ; Chr(03) ; Chr(26)
Getline Sret
Cls : Lowerline
Lcd Sret
Wait 4

Print "AT+CIPSEND" ; Chr(13)
Wait 1
Print 123
Getline Sret
Cls : Lowerline
Lcd Sret
Wait 4

Print "AT+CIPSEND" ; Chr(13)
Wait 1
Print "123"
Getline Sret
Cls : Lowerline
Lcd Sret
Wait 4


'--------------------------------------------------


Do
Getline Sret ' get data from modem
Cls : Lowerline
Lcd Sret
Wait 1
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
Flushbuf




End



Sub Showsms(s As String )
Cls : Home
I = Instr(s , ",") ' find comma
I = I + 1
Stemp = Mid(s , I) ' s now holds the index number
Lcd "Number=" ; Stemp
Wait 1

Print "AT+CMGR=" ; Stemp ' get the message
Getline S1
Getline S2 ' header +CMGR: "REC READ","+316xxxxxxxx",,"02/04/05,01:42:49+00"
Cls : Home : Lcd "back sms"
Wait 1
Print "AT+CMGF=1" ; Chr(13)
Wait 1
Print "AT+CMGS=" ; Chr(34) ; "0913333333" ; Chr(34) ; Chr(13)
Wait 1
Print S1
Wait 1
Print S2 ; Chr(26)
Lowerline : Lcd "backed sms1"
Wait 4
Cls : Home
Lcd "remove sms"
Print "AT+CMGD=" ; Stemp ' delete the message
End Sub


Sub Getline(s As String)
S = ""
Do
B = Inkey()
Select Case B
Case 0 'nothing
Case 13 : If S <> "" Then Exit Do ' 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
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top