View Full Version : sms to control pic..pls help...
Ziki
- 13th August 2006, 11:46
hi ....i doing a project on sms to control a robot ....i'm using t610 SE phone as GSM phone as it can support AT command , the pic i'm using is just 16F84 ....can give me a abit of guide lines ??.....1st of all ...can tell me which pin of the phone is for TX,RX and ground ...?
pls help ....
thx alot
savnik
- 13th August 2006, 19:05
SonyEricsson R520, R310, R320, T28, T39, T68, T68i, R600, T610, T310 and others cell phones pinout
http://pinouts.ru/CellularPhones-A-N/erics_t28_pinout.shtml
Ziki
- 14th August 2006, 18:10
thx alot for your help savnik. Are you familiar with this project ?? or does anyone familiar with it ...might need some guidedance ...thx again ...
f_lez
- 20th August 2006, 09:49
thx alot for your help savnik. Are you familiar with this project ?? or does anyone familiar with it ...might need some guidedance ...thx again ...
I just started something similar, was going to use a 2550 but using a f88 at the moment, dont connect port A to your phone, it wont work on the f88, no I dont know why! (just spent a day hitting it)
Connect phone to port B, I used a 1k resistor to protect the phone from the 5v of the pic, but maybe 560ohm would be ok too, I did try none, worked fine, but I put the 1k back to be safe.
I can send data to the T610 and a T68i at T2400 and T9600 with a 4mhz crystal with no problems. I dropped back to 2400 to be safe.
Today I am hoping to get data from the phone back into the pic.
Biggest problem you will have is the format of the sms message is pdu mode0 only............
This means you will have to read in the entire sms which could be 255 chars etc.
I suppose you could limit theincoming data size by discarding what you dont need, IE only send it a short message with short commands.
But you still need to skip over header, and you may want to authenticate the message sender
{edit}
also tried a t100, nothing. dont know why, its old maybe its bust.
{edit2}
Also phone pinouts on web cant be trusted!
I used 4 and 5, 4 is data in to phone, 5 is data out, maybe I should have tried different pins for the t100
Ziki
- 23rd August 2006, 10:00
thx for the info ...:) i believe t610 can support text mode ? izzit true ?
f_lez
- 24th August 2006, 09:10
thx for the info ...:) i believe t610 can support text mode ? izzit true ?
No the t100, t68, t681, t610 I can say with definate authority only support PDU mode.
This makes them a total pain for sms controllers.
You have to type the sms command very carefully......
If you sent alarm arm it would be 09417658DE0685E56D
if you sent alarm arm. it would be 0A417658DE0685E56D17
If you sent alarm arm it would be 09A0203B2C6F83DE6E
Just one extra space makes it totally different.....
You have to be very strict on how messages have to be sent, which also means you can just check parts of the string like this as most of it will always be the same.
Alarm arm 0AD09417658DE0685E56D
Alarm off 0AD09417658DE06BDCD66
You can just test at various points to parse it IE
0AD09 (4176) 58DE06B (DCD) 66
0AD09 (4176) 58DE068 (5E5) 6D
Put it all in a byte array and then 'if then it'
If buf(6)<>"4" then wait_for_command
if buf(6)<>"1" then wait_for_command
If buf(6)<>"7" then wait_for_command
If buf(6)<>"6" then wait_for_command
' Ok so we have a command, now which one
If buf(17)<>"D" then not_arm_command
If buf(18)<>"C" then not_arm_command
If buf(19)<>"D" then not_arm_command
' OK we got here so its 'arm' command
Gosub arm_the_alarm
goto wait_for_commands
not_arm_command: ' so check for 'off' command
If buf(17)<>"5" then not_off_command
If buf(18)<>"E" then not_off_command
If buf(19)<>"5" then not_off_command
Gosub alarm_off
goto wait_for_commands
not_off_command:
' if we got here the command was not understood
gosub error_comand
goto wait_for_commands
Ziki
- 26th August 2006, 16:39
thx flez.....sorry i'm not very familiar with the code you have given ...maybe if possible ..can you send me a code on a simple program ( on a LED when t610 receive sms " ONLED" and off it when recieve "OFFLED" ..thx alot
f_lez
- 27th August 2006, 09:16
thx flez.....sorry i'm not very familiar with the code you have given ...maybe if possible ..can you send me a code on a simple program ( on a LED when t610 receive sms " ONLED" and off it when recieve "OFFLED" ..thx alot
My point was your pic will not see 'OFFLED' it will see a string of hex digits like "67687687687686709878986587690809785476784655875487"
Off led is:
064FA391592402
06 is 6 bytes of message and
4FA391 is off
592402 is led
but if you type offled then you get
06
6FB399 off
5D2603 led
you need to read up on pdu mode if your using ericsson
pdu mode is more common than text mode phones, I dont know of new phones that support text so learn to use pdu its all the phone manufacturers are offering!
download pduspy, a link is on google.
Acetronics2
- 28th August 2006, 13:17
Hi,
That's not Pic ... but have a look !!!
http://www.serasidis.gr/circuits/smscontroller/smscontroller.htm
Alain
Ziki
- 5th September 2006, 11:04
thx for the link acetronics..........
f_lez
- 6th September 2006, 09:57
You can make it all work without worrying about decoding the pdu's, dont be scared off by them!
Provided you always send commands in a set way, a protocol if you like, then it wont matter that its not text.
IE..
617658DE06BDDD alarm on
617658DE06BDCD66 alarm off
You just check a few key points in the above, ie
617 658D E06B DDD alarm on
617 658D E06B DCD66 alarm off
Just check for 658d, if you have that you have the alarm word,then check for DDD, if you have then its on, if DCD then its off, if not any, its a user/sms/command error.
Thats how I have mine working now.
And sending a sms back is easy too, ie...
serout portb.6,t1200,["atz",13] ' wake up thephone
pause 500
serout portb.6,t1200,["at+cmgs=",#ln,13] ' tell it we want to send a txt
pause 2000
serout portb.6,t1200,["0011000C91"] ' start of the pdu data
for x=1 to 12 ' send it the destination phone number, 12 digits international format
serout portb.6,t1200,[pduphn(x)]
next
serout portb.6,t1200,["00F0AD"] ' next part of header
' ****** Put all the above in a subroutine, every message you send will need the same header, all you need to send a different message is to change the next lines
serout portb.6,t1200,["C8329BFD06DDDF723619"] ' hello world
pause 9000 ' wait for phone to send
You can just change the hello world to whatever you want, remember if you change the length, you need to tellthe phone the incoming data is a different length.
use 'pdu spy' to create the pdu text you need.
Ziki
- 18th September 2006, 17:27
thx for the info ...sorry for late reply ....bz lately with exam .......in the #6 post u put :
If buf(6)<>"4" then wait_for_command
if buf(6)<>"1" then wait_for_command
If buf(6)<>"7" then wait_for_command
If buf(6)<>"6" then wait_for_command
do i need to store the recieve message( Alarm arm 0AD09417658DE0685E56D
)into the buffer 1st ...?
precision
- 19th September 2006, 04:02
I think this help you, this is the compleet command list that work for picmicro.
http://www.precision.net.in/picbasic/sony_er_at_commands_dev_guidelines.pdf
http://www.precision.net.in/picbasic/siemens_at_command.pdf
f_lez
- 19th September 2006, 11:20
thx for the info ...sorry for late reply ....bz lately with exam .......in the #6 post u put :
If buf(6)<>"4" then wait_for_command
if buf(6)<>"1" then wait_for_command
If buf(6)<>"7" then wait_for_command
If buf(6)<>"6" then wait_for_command
do i need to store the recieve message( Alarm arm 0AD09417658DE0685E56D
)into the buffer 1st ...?
Yes, make buf(XX) large enough for your longest message, but remember that a message has a huge 60 chars plus overhead, dont store those, you have to read them, but dont store them, and then simply read what you want with a for next loop.
use serin with a timeout so if the message is short, it will keep going, and also if the message is short, you need to skip any further serin commands, IE
for z=0 to 90
buf(z)="*"
next
error_flag=0
for n=1 to 20 digits
get_back_in_loop:
if error_flag=0
SERIN portb.7,t1200,1000,comserr,combuf(z)
endif
next
goto finished read
comserr:
error_flag=1
goto get_back_in_loop
finished_read:
OK so we have now read the string in (in a dirty horrible looking way) so you can now process it as you need
You will have to write another routine, to call (gosub) before that, to read the first 46 or so chars, then you can read the next 12 and save them as there are the originating phone number, you may want to check that for an authentic message sender, then dump another 20 as they are time/date etc, unless you want to do something with them.
remember it screws phone numbers / time date etc up too, so a phone number of 1234 becomes 2143, stupid damn system.
Ziki
- 19th September 2006, 13:18
hi ..there's a problem ......when i connect my data cable which i have modify it to become serial instead of usb ....(coz canot find it anymore ) to the T610 with the PC .the hyperterminal doesn't seems to respond :< ..canot type anything on it ...pls advice ..thx .....
Ziki
- 19th September 2006, 14:54
i use pin 4 (Rx)from T610 SE to pin 3(Tx) of db-9 female
pin 5(Tx) from t610 to pin 2(Rx) of db9 female
pin 8(Gnd) from t610 to pin 5(Gnd) of db9 female
f_lez
- 20th September 2006, 07:08
to connect to pc 9 pin serial you need a max232.
your phone is 0v and 3.6v serial, your pc is -12v and +12v, your phone's port may be damaged after that.
I have had no problems with a t610 connected to a pic16f88 at 5v. but may in my finished design include a resistor.
Ziki
- 20th September 2006, 17:15
ooic .....ok..i try it out 1st ..thx alot .....:)
Ziki
- 25th September 2006, 17:11
hi ..i have done the max 232 but it canot work .....i attached my diagram .....is there any error ????
f_lez
- 26th September 2006, 01:15
looks fine to me.
same as this one.
http://pinouts.ru/CellularPhonesCables/ericsson_cable_pinout.shtml
Ziki
- 26th September 2006, 16:49
there's a correction in my schematic ..i'm using max 232 ...not max323....why must and is it necessary that the DB9 pin 4 and 6 shorted .7 and 8 shorted together ???since i canot make this work yet ..so plan to work on the micro C and phone commmunication ...flez ..do you have a schematic for your project ...can i have a look .....thx alot ....
f_lez
- 27th September 2006, 10:38
I'm using rb6 and 7 connected direct to phone, and a gnd.
its not a pretty sight to look at is my 'development stage' but I am moving to a better pcb!
http://homepage.ntlworld.com/tinabriddon/bday/DSC00466.JPG
It has 3 cables..........
one is a usb data cable, I'm using that as an input to the pc on com5 to monitor what the phone is sending to the pic.
Other cable is a serial data cable on com1, I'm using that to monitor what the pic sends to the phone.
Phone is connected to pic and the cables above, but it does not need the cables to the pc, just for debugging.
I used no resistors between phone and pic, but I think I should have done, say 560 ohm at a guess as a bit of protection as phone is 3v not 5v, but after weeks of running it like this, nothing has gone wrong.
I use power from usb for the pic 5v.
Ziki
- 28th September 2006, 03:59
thx for picture :)
the max 232 part ...is it necessary that the DB9 pin 4 and 6 shorted .7 and 8 shorted together which is shown in http://pinouts.ru/CellularPhonesCables/ericsson_cable_pinout.shtml
does it serve any purpose?
Ziki
- 29th September 2006, 14:37
hi.....i suceed in the hyperterminal part ..there's a connection between phone and pc...now my problem is how to automatically save recieved sms into my sim card because i can only read the sms that are save in sim card..(at+cmgr=1)
and also in hyperterminal ..t610 can support text mode(at+cmgf=?)
it show (0,1)
does it mean it can support text mode ???
f_lez
- 29th September 2006, 18:13
hi.....i suceed in the hyperterminal part ..there's a connection between phone and pc...now my problem is how to automatically save recieved sms into my sim card because i can only read the sms that are save in sim card..(at+cmgr=1)
and also in hyperterminal ..t610 can support text mode(at+cmgf=?)
it show (0,1)
does it mean it can support text mode ???
ericsson only pdu mode, no text mode, :(
pdu is not that hard if you only look for 'key' strings of digits.
download ericsson manual, at+cmgr=1 only read memeory 1, of the current memory, you need to change the current memory from sim to phone (SM to ME)
Ziki
- 5th October 2006, 16:26
hi...i'm facing some problem ....when i use hyperterminal ...i got no problem ...can receive and send sms but when i connect it to my uC . it canot work ...must the phone go thrught a max232 when connect to uC?? i'm using t610 :)
pls help..thx alot ....
f_lez
- 6th October 2006, 10:48
I connected t610 (and t68i) to pic 16f88, no max232, no resistors, just wire.
look at picture above, pic on dev board, connected to phone.
Ziki
- 8th October 2006, 03:25
hi ....i finally suceed in trasmitting part( uC to "tell" GSM phone to send a sms )
now i workin on receiveing part(uC to accept information from GSM phone )before this i was using ATMEL ..with BASCOM ..but don't no why it canot work ...spend a week in lab but no result ...:(
now for the PIC ..which should i use ?
Hserin or Serin or Serin 2
if u don't mind ...can pls share some code example here ..
thx alot ....
f_lez
- 9th October 2006, 11:37
now for the PIC ..which should i use ?
Hserin or Serin or Serin 2
if u don't mind ...can pls share some code example here ..
thx alot ....
I used serin, no reason except I always worked with the f84 and just carried on!
I can let you have my code, you can do with it what you will, its really poorly written and just banged together.
Its unfinished, in fact not done anything with it in about 3 weeks so will take me a day to get back in to it!
Problem was the project was drafted out in my head to use a 2550 for a gsm equipped car alarm, but I only had a f88 to hand, so started on that, idea was I could just recompile the code / cut and paste the routines, then it went off in a different direction as a cut down version of the project using a f88 as a garage/house/boat/shed, so has some features not now needed and ones not yet done.......
http://homepage.ntlworld.com/tinabriddon/pic/
Its a real work in progress........
Ziki
- 10th October 2006, 08:22
thx for the code....can you have a look at this ...
DEFINE OSC 8
DEFINE HSER_TXSTA 24h
DEFINE HSER_RCSTA 90h
DEFINE HSER_BAUD 9600
DEFINE HSER_SPBRG 129
DEFINE HSER_CLROERR 1
sms:
HSEROUT ["AT" ,13,10]
hserin 5000,sms,[WAIT("OK")]
HSEROUT ["AT+CMGF=1" ,13,10]
hserin 5000,sms,[WAIT("OK")]
HSEROUT ["AT+CMGS=",34,"my number ",34,13,10]
hserin 5000,sms,[WAIT(">")]
HSEROUT ["BUTTON HAS BEEN",26,13,10]
pause 5000
end
it doesn't work (canot send sms ) ..but if i just use hserout and use pause instead of hserin .it work perfectly ...so...the problem must be at the hserin .
i try using 4 Mhz and lower baud rate ..also canot work ..:(
is there any problem in my code ??? thzzzz
Ziki
- 10th October 2006, 10:35
hi ..i also try out with this code ..also canot work....
include "modedefs.bas"
DEfine OSC 4
sms:
pause 1000
serout portb.6,t1200,["atz",13] ' wake up thephone
serin portb.7,t1200,5000,sms,["OK"]
serout portb.6,t1200,["at+cmgs=19",13]
serin portb.7,t1200,5000,sms,[">"]
serout portb.6,t1200,["07910621000010F511000B910621297767F80000AA05E8329B FD06",26,13]
pause 9000
end
as usual this code work fine with pause instead of serin command ..it suppose to send out a "hello " sms
what have i done wrong ????pls help ..thx ...
Ziki
- 11th October 2006, 08:03
hi ..the problem from the previous tread have solved :)
now ..i'm having problem storing those valur to my array
below are my code
sms:
include "modedefs.bas"
DEfine OSC 4
buffer var byte(90)
z var byte
TRISB= %10001011
serout portb.6,t1200,["atz",13]
serin portb.7,t1200,5000,sms,["OK"]
pause 2000
serout portb.6,t1200,["at+cpms=",34,"me",34,13]
serin portb.7,t1200,5000,sms,["CPMS"]
pause 2000
serout portb.6,t1200,["at+cmgr=1",13]
for z=1 to 90
serin portb.7,t1200,5000,sms,buffer(z)
next
end
this code canot work ....is it possible to store everting in a array ?..i don't know how to filter out those unwanted ones....
f_lez
- 11th October 2006, 09:22
One problem with your loop of 1 to 90 is what if you dont have 90 incoming chars ?
The only real way to read a sms is to read one char and loop until no more arrive, you only need a short timeout, say half second.
That why I dod not use a for loop
also
serout portb.6,t1200,["at+cpms=",34,"me",34,13]
serin portb.7,t1200,5000,sms,["CPMS"] ************* Why have this line ?
pause 2000
The line is not really needed, you dont need the data, while I suppose its more correct to have it, its using code space etc
Ziki
- 12th October 2006, 04:40
oo..ya.the cpms is just for testing purpose ..nothing more..:)
now just to test the code can skip certain amount of character and store the wanted value into buffer ,i modify the code ,..i want to store "M" into buffer(1),"G" into buffer(2) and R into buffer(3)
include "modedefs.bas"
DEfine OSC 4
buffer var byte[90]
z var byte
x var byte
TRISB= %10001000
portb.4=0
portb.2=0
portb.1=0
serout portb.6,t1200,["atz",13]
pause 2000
serout portb.6,t1200,["at+cpms=",34,"me",34,13]
pause 2000
serout portb.6,t1200,["at+cmgr=1",13]
x = 2
while x>0
x = x-1
SERIN portb.7,t1200,1000,oops2,z
oops2:
wend
for x=1 to 3
SERIN portb.7,t1200,1000,oops,buffer(x)
oops:
next x
pause 2000
if buffer(1) ="M" then
portb.1=1
if buffer(2) ="G" then
portb.2=1
if buffer(3)="R" then
portb.4=1
endif
endif
endif
end
in hyperterminal .....the phone response with this :
at+cmgr=1
+CMGR: 1,,26
07910621000110F5040B910621297377F40000600111221064 230853BA3C9C3EA3E9
from the code above ...none of the LED light up :( is there problem with the code? thx ......
f_lez
- 12th October 2006, 09:11
It looks like it should work, but what speed are running comms at, doh! just realised its 1200, doh!
just try it again 300, see it the program is just not fast enough to catch it.
Ziki
- 13th October 2006, 05:12
hi..i have change to T300 and also omit the "skipping" character part so that i can focus on just storing data in array.
include "modedefs.bas"
DEfine OSC 4
buffer var byte[90]
z var byte
x var byte
TRISB= %10001000
portb.4=0
portb.2=0
portb.1=0
serout portb.6,t300,["atz",13]
pause 2000
serout portb.6,t300,["at+cpms=",34,"me",34,13]
pause 2000
serout portb.6,t300,["at+cmgr=1",13]
for x=1 to 3
SERIN portb.7,t300,1000,oops,buffer(x)
oops:
next x
pause 2000
if buffer(1) ="+" then
portb.1=1
if buffer(2) ="C" then
portb.2=1
if buffer(3)="M" then
portb.4=1
endif
endif
endif
end
now ...only portb.1 LED light up ..:( ....running out of idea .
f_lez
- 13th October 2006, 09:42
emm, I cant do anything at the moment I'm changing my PC/desk everything, but try it this way.......
x=1
while x<4
serin buffer(x)
x=x+1
wend
or use if....then... etc, I remember when I used a for loop I had a problem that went a way for no reason, I think its when I stopped using the ...for...next...
Or I could be wrong.........
<edit>
Yes I am wrong because I have it working with a foor loop IE
for x=1 to 12
SERIN portb.7,t1200,500,oops,incphn(x)
oops:
next x
<edit2>
Can you use a max232 circuit or an old phone data cable to monitor on the PC with hyperterminal what is goin on?
If you put it on the phone output, you get to see (because the phone echos) what your pic is sending, and what the phone replys with.
peter_o_tool
- 15th October 2006, 08:19
test
p_O_t
emm, I cant do anything at the moment I'm changing my PC/desk everything, but try it this way.......
x=1
while x<4
serin buffer(x)
x=x+1
wend
or use if....then... etc, I remember when I used a for loop I had a problem that went a way for no reason, I think its when I stopped using the ...for...next...
Or I could be wrong.........
<edit>
Yes I am wrong because I have it working with a foor loop IE
for x=1 to 12
SERIN portb.7,t1200,500,oops,incphn(x)
oops:
next x
<edit2>
Can you use a max232 circuit or an old phone data cable to monitor on the PC with hyperterminal what is goin on?
If you put it on the phone output, you get to see (because the phone echos) what your pic is sending, and what the phone replys with.
f_lez
- 16th October 2006, 08:47
lol hello and welcome.
zaliko
- 15th December 2006, 11:49
It's not tested but try this one:
include "modedefs.bas"
DEfine OSC 4
buffer var byte[20]
z var byte
x var byte
TRISB= %10001000
portb.4=0
portb.2=0
portb.1=0
serout portb.6,t300,["atz",13]
pause 2000
serout portb.6,t300,["at+cpms=",34,"me",34,13]
pause 2000
serout portb.6,t300,["at+cmgr=1",13]
; wait + sign for 1 second and then store next 2 signs in buffer[0] and buffer[1]
SERIN portb.7,t300,1000,oops,["+"],buffer[0],buffer[1]
portb.1=1 ; port be is high beqause + sign already detected
if buffer(0) ="C" then
portb.2=1
endif
if buffer(1)="M" then
portb.4=1
endif
goto dasasruli
oops: ;no answer from the phone
; do something if there is no answer
dasasruli:
end
jamshid.dastur
- 10th December 2008, 00:28
I'm new to serial communication, can anyone tell me what does the 34,34,13 do in the below syntax???
serout portb.6,t300,["at+cpms=",34,"me",34,13]
and whats the difference between above and
serout portb.6,t300,["at+cmgr=1",13]
also please tell me does oops block get executed if + is not received ???
SERIN portb.7,t300,1000,oops,["+"],buffer[0],buffer[1]
It's not tested but try this one:
include "modedefs.bas"
DEfine OSC 4
buffer var byte[20]
z var byte
x var byte
TRISB= %10001000
portb.4=0
portb.2=0
portb.1=0
serout portb.6,t300,["atz",13]
pause 2000
serout portb.6,t300,["at+cpms=",34,"me",34,13]
pause 2000
serout portb.6,t300,["at+cmgr=1",13]
; wait + sign for 1 second and then store next 2 signs in buffer[0] and buffer[1]
SERIN portb.7,t300,1000,oops,["+"],buffer[0],buffer[1]
portb.1=1 ; port be is high beqause + sign already detected
if buffer(0) ="C" then
portb.2=1
endif
if buffer(1)="M" then
portb.4=1
endif
goto dasasruli
oops: ;no answer from the phone
; do something if there is no answer
dasasruli:
end
Best Regards
Jamshid Dastur
aratti
- 11th December 2008, 18:01
Jamshid, The code :
["AT+CPMS=",34,"ME",34,13]
will not work. You should write:["AT+CPMS=ME",13]
because ascii code 34 = "
This AT command will set memory "ME" as the sms working place.
["AT+CMGR=1",13]
This AT command will call a sms in memory location 1
Yes, If the plus sign is not received, then after one second program will jump to oops label.
Al.
jamshid.dastur
- 11th December 2008, 23:57
Thanks a lot Aratti.
Best Regards
Jamshid Dastur
jamshid.dastur
- 12th December 2008, 00:06
Can you help me out with one more thing, that is how can i read an sms and store it in an array, lets say an sms contains hi, then which syntax should i use, or if there is some alternative better way...
Syntax1:
buffer var byte[90]
serout portb.6,t300,["at+cmgr=1",13]
SERIN portb.7,t300,1000,oops,["+"],buffer[0],buffer[1]
Syntax2:
buffer var byte[90]
serout portb.6,t300,["at+cmgr=1",13]
for x=1 to 3
SERIN portb.7,t300,1000,oops,buffer(x)
next x
or is there any other way to store the sms in the array,
thanks a lot
Best Regards
Jamshid Dastur
aratti
- 12th December 2008, 12:32
You must send this sms : "123 HI" (123 is the pointer).
Then I suggest the following code:
buffer var byte[90]
SEROUT2 portb.6,3313,["AT^SMGR=1",13] ' Call for sms
SERIN2 portb.7,3313,1000,oops,[Wait ("^SMGR:" ),Str buffer \ 5] ' (3313 is baud rate = 300 see PBP manual pag 133)
if buffer[1]=48 and buffer[4]=48 then oops ' if no sms has been received then jump to oops label
SERIN2 portb.7,3313,[Wait ("123"),Str buffer \ 3] ' If sms is present wait for pointer then load array
If everything work, then you should find:
buffer[0]=32 (space)
buffer[1]=H
buffer[2]=I
If you want a ready made sms system download it @:http://techni.caliti.es/blog/
Al.
jamshid.dastur
- 13th December 2008, 00:06
Thanks once again,
Best Regards
Jamshid Dastur
jamshid.dastur
- 23rd December 2008, 03:34
Hello, i'm stucked at the point that our dear PIC works on 5V, and thus definitely the serin/serout would also generate high and low pulses of 0-5v, while the GSM module which i'm having (SIM508) posses serial transmission module of VMax being 3V...and it's been quoted to use a level converter where necessary, so can anyone help me out with this...
can i use MAX233 in between or would there be any other procedure to follow...
Best Regards
Jamshid Dastur
Archangel
- 23rd December 2008, 04:38
Hello, i'm stucked at the point that our dear PIC works on 5V, and thus definitely the serin/serout would also generate high and low pulses of 0-5v, while the GSM module which i'm having (SIM508) posses serial transmission module of VMax being 3V...and it's been quoted to use a level converter where necessary, so can anyone help me out with this...
can i use MAX233 in between or would there be any other procedure to follow...
Best Regards
Jamshid DasturHello Jamshid Dastur, I think a simple transistor would work to switch data @ 5 volts, keeping in mind it would invert the data.
jamshid.dastur
- 24th December 2008, 08:24
Hello Jamshid Dastur, I think a simple transistor would work to switch data @ 5 volts, keeping in mind it would invert the data.
Hi Joe, are you sure about MAX ic that its not a serial decoder, and just a level shifter, if so...then i can simply use a zener diode to drop voltage and a 40XX buffer ic to up the level without any inversion...
Best Regards
Jamshid Dastur
Archangel
- 24th December 2008, 08:45
Hi Joe, are you sure about MAX ic that its not a serial decoder, and just a level shifter, if so...then i can simply use a zener diode to drop voltage and a 40XX buffer ic to up the level without any inversion...
Best Regards
Jamshid Dastur
Aw heck no, I'm not SURE about anything! I thought you wanted to switch a 5v level with 3v, I guess you want to go the other way.
aratti
- 24th December 2008, 17:18
Jamshid, you should use a MAX3232 not a Max233. But there is a simpler way to interface serial TTL to a serial 3V, this is using a partition of resistors. Use for each line (Tx & Rx) 3x10K resistor in series from pic pin to ground. Connect the 3 V serial device to the second resistor so that you have 20K from ground for the 3 V device and 30K for the TTL. This is the system I use and it works fine.
Al.
f_lez
- 11th April 2010, 19:30
Jamshid, The code :
will not work. You should write:["AT+CPMS=ME",13]
because ascii code 34 = "
This AT command will set memory "ME" as the sms working place.
holy thread resurrection batman...
Yes thats correct, it DOES need the chr(34)'s.............
I just checked this on t610 and t68i and t68
I just restarted doing this all over again, and hit a new issue, after a while the phone stops responding to most commands, but some, ie the simple ones like atz, work...
atz returns ok , at+cfun=1 returns error, at+cmgr1=error, power cycle the phone, they all work again, how am I crashing/confusing it, i dont know, how can i fix it, i dont yet know.....
Cobra_Phil
- 12th April 2010, 14:51
I worked on a project last year where I needed to send a GPS string using PDU mode. I received the GPS string, converted it to PDU mode, then instructed my phone via blue tooth to send the GPS coordinates to my email account. Anyway, when you want to do something like this, you can not hard code the data you want to send obviously because it is always changing. Here is a snippet of the code, pay attention to the octets_to_septets subroutine. Basically PDU mode converts 1 byte into 7 bits for compression, then moves the next byte left 1 bit, etc. The line above the call to the routine, which I have modified so i don't get a bunch of emails from people trying this code, I have hard coded the email address and other configuration bits. Maybe this can be of use to someone.
Loop1:
HSerOut ["AT",13,10]
HSerIn 3000,Loop1,[Wait("OK")]
Print $FE,$C0,"Connected"
DelayMS 750
Loop2:
HSerOut ["AT+CMGF=?",13,10]
HSerIn 3000,Loop2,[Wait("("),Dec Mode]
If Mode = 0 Then Print $FE,1,"PDU Mode"
If Mode = 1 Then Print $FE,1,"Text Mode"
DelayMS 750
Loop3:
HSerOut ["AT+CMGF=",Dec Mode,13,10]
HSerIn 3000,Loop3,[Wait("OK")]
If Mode = 0 Then Print $FE,$C0,"PDU Mode Set"
If Mode = 1 Then Print $FE,$C0,"Text Mode Set"
DelayMS 750
Print $FE,1,"Waiting For GPS..."
Loop4:
LoopCount = 0
DelayMS 500
SerIn RX,188,[Wait("$GPRMC,"),Str GPSData\65]
If GPSData[10] = "A" Then 'Check for valid position
Print $FE,1,"Sending Message..."
HSerOut ["AT+CMGS=94",13]
HSerIn 10000,Loop4,[Wait(">")]
HSerOut ["07913121139418F00100039121F............."]
GoSub octets_to_septets
DelayMS 1000
HSerOut [26,13,10]
HSerIn 10000,Loop4,[Wait("OK")]
Print $FE,$C0,"Message Sent"
Else
Print $FE,$10,GPSData[10]
DelayMS 5000
GoTo Loop4
EndIf
DelayMS 1000
Loop5:
SerIn RX,188,[Wait("$GPRMC,"),Str TIME\6,skip 4,FIX,skip 1,Str LAT\9,skip 1,NS,skip 1,Str LON\10,skip 1,EW,skip 1,Str SPD\5,skip 1,Str HEAD\5,skip 1,Str DATE\6]
Print $FE,1
Print $FE,2,"LAT:",Str LAT\9," ",NS
Print $FE,$C0,"LON:",Str LON\10," ",EW
'spd = spd * 1.151
Print $FE,$94,"SPD:",Str SPD\5," knots"
PrintDate = Mid$(DATE,3,2) + "/" + Mid$(DATE,1,2) + "/" + Mid$(DATE,5,2)
PrintTime = Mid$(TIME,1,2) + ":" + Mid$(TIME,3,2) + ":" + Mid$(TIME,5,2)
Print $FE,$D4,Str PrintDate," ",PrintTime
If FIX = "A" Then
Print " "
Else
Print " -"
EndIf
DelayMS 350
If FIX = "A" Then Print $FE,$10,"*"
DelayMS 150
Inc LoopCount
If LoopCount >= 120 Then
GoTo Loop4
EndIf
GoTo Loop5
octets_to_septets:
For i = 0 To Len(GPSData)
CurrChar = GPSData[i]
If i <> 0 And i // 8 <> 0 Then
OctFir = CurrChar << (8 - i // 8)
OctCurr = OctFir + OctSec
HSerOut [HEX2 OctCurr]
OctSec = CurrChar >> (i // 8)
Else
OctSec = CurrChar >> (i // 8)
EndIf
Next i
Return
Stop
f_lez
- 12th April 2010, 21:19
Yes if its a pdu mode phone, the you do have to convert, but if you can get the HW side of nokia working it uses text mode.
mind you with the lack of string commands in pbp working in pdu mode is just as easy lol.
the point i made (years ago!) is tha if the data is not changing, and the responses are set, say for like a garage door opener where the only responses could be door open or door closed, then you can pre-encode them and just use them as pdu strings.
Same with the incoming, if the commands coming in are pre-set , ie open door, close door, you can pre-compile the expected expected result and compare the received pdu string to the pre-compiled expected response.
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.