PDA

View Full Version : Gsm/Gps Tracker



camolas
- 13th October 2008, 19:12
Hi there.

For starters i will put the my way off connecting the nokia 6210 with the pic no max 232 need, later i will post the full code.

http://img159.imageshack.us/img159/5423/esquemari7.th.jpg (http://img159.imageshack.us/my.php?image=esquemari7.jpg)http://img159.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)

Xau.

camolas
- 14th October 2008, 15:54
In the 1st there was a missing wire this is the good one.

<a href="http://imageshack.us"><img src="http://img392.imageshack.us/img392/8734/esquemaxa1.jpg" border="0" alt="Image Hosted by ImageShack.us"/></a><br/><a href="http://g.imageshack.us/img392/esquemaxa1.jpg/1/"><img src="http://img392.imageshack.us/img392/esquemaxa1.jpg/1/w851.png" border="0"></a>

Xau.

xnihilo
- 14th October 2008, 16:09
In the 1st there was a missing wire this is the good one.

<a href="http://imageshack.us"><img src="http://img392.imageshack.us/img392/8734/esquemaxa1.jpg" border="0" alt="Image Hosted by ImageShack.us"/></a><br/><a href="http://g.imageshack.us/img392/esquemaxa1.jpg/1/"><img src="http://img392.imageshack.us/img392/esquemaxa1.jpg/1/w851.png" border="0"></a>

Xau.

Hey dude, what is it used for exactly?

camolas
- 15th October 2008, 12:36
Hi,

This is for conecting a nokia phone and a pic, you will control the phone from the pic, later i will post a code where you can with a serial gps send a sms with the gps data.

Xau.

camolas
- 27th October 2008, 18:25
Here is my full and working code for a gps/alarme/gsm.


*********************************************
@ Device HS_OSC
define OSC 20

Include "modedefs.bas" ' Include serial modes


Clear
sms var byte[10]
numero VAR BYTE[12]
Lat var byte[11]
Long var byte[11]

TrisB.7=0 ' LIGA GSM
TrisB.6=1 ' IGNIÇÃO
TrisB.5=1 ' SENSORES
TrisB.4=0 ' FEXA PORTAS
TrisB.3=0 ' PISCAS
TrisB.2=0 ' IMOBLIZA
TrisB.1=0 ' ?????????????
TrisB.0=0 ' LED OK VERDE

TrisC.4=1 ' RX BT
TrisC.5=0 ' TX BT
TrisC.6=0 ' TX GSM
TrisC.7=1 ' RX GSM

TrisD.1=1 ' RX GPS

Low PortB.1
Low PortB.2
Low PortB.3

Inicio:
Low PortB.0
Pause 500
High PortB.0
Pause 500
Low PortB.0
Pause 500
High PortB.0
Pause 500
Low PortB.0
Pause 500
High PortB.0
Pause 500
Low PortB.0
Pause 2000

UM:
Low PortB.1
HSEROUT["at",13,10]
HSERIN 10000,UM,[WAIT("OK")]
LCDOut $FE, 1,"ON"
HIGH PortB.0

DOIS:
serin2 portD.1, 188, [WAIT("$GPRMC,"),skip 13, STR LAT\11,skip 1, STR Long\12]
High PortB.1


HSEROUT["AT+CMGF=1",13,10]' Modo Texto
HSERIN 10000,UM,[WAIT("OK")]


HSEROUT["AT+CMGR=1",13,10] ' Ler sms
HSERIN 5000,UM,[WAIT("REC UNREAD"),skip 3, STR numero\13,skip 27,STR sms\10]


IF sms[0]="S" and sms[1]="t" and sms[2]="o" and sms[3]="p" Then
goto Tranca
Endif

IF sms[0]="C" and sms[1]="e" and sms[2]="l" and sms[3]="i" and sms[4]="a" Then
goto Destranca
Endif

IF sms[0]="P" and sms[1]="o" and sms[2]="s" Then
goto PO
Endif

Goto APAGA

Tranca:
High PortB.3 'Piscas
Pause 500
High PortB.2 ' Imobliza
Goto PO

Destranca:
Low PortB.3 'Piscas
Low PortB.2 ' Imobliza
Goto APAGA

Liga: ' LIGA GSM
High PortB.7
Pause 20000
Goto UM

PO: ' Envia localizacao
HSEROUT["AT+CMGS=",34,"+351xxxx32xxx", 34,13] ' Phone number to get the gps sms data
hserin 10000,PO,[WAIT(">")]
HSEROUT["LAT: ",LAT (10),"-", LAT, lat (1),"'",lat (2),Lat(3),".",lat (5),lat(6),lat (7),lat(8),$fe,$c0,"LON: ", Long(11),"-", Long (1),long (2),"'",Long (3),long (4),".",Long (6),long (7),long(8),long (9),13,10]
HSEROUT[26]


APAGA:
HSerout ["AT+CMGD=1",13,10]' apaga sms 1
hserin 10000,APAGA,[WAIT("OK")]
HSerout ["AT+CMGD=2",13,10]
Pause 5000
goto Inicio

End
************************************************** ********

I get sender number (numero VAR BYTE[12]) but cant use it in the HSEROUT["AT+CMGS=",34,"+351xxxx32xxx", 34,13] i try HSEROUT["AT+CMGS=",34,"Str numero", 34,13] but no sucess can the masters give me some hellp?
Thanks

Xau

mackrackit
- 28th October 2008, 09:59
I get sender number (numero VAR BYTE[12]) but cant use it in the HSEROUT["AT+CMGS=",34,"+351xxxx32xxx", 34,13] i try HSEROUT["AT+CMGS=",34,"Str numero", 34,13] but no sucess
Try sending "numero" like you are for "lat" and "Lon", one piece at a time.

aratti
- 28th October 2008, 11:06
Camola, try the following:

Use a larger array in such a way that you can accomodate the calling string in the initial part of the array:

Arry[0]=65
Arry[1]=84
Arry[2]=43
Arry[3]=67
Arry[4]=77
Arry[5]=71
Arry[6]=83
ArrY[7]=43

The above sequence contains the string AT+CMGS=+

Than you tranfer the sender number (12 bytes) in Arry[8] to Arry[19]. Remember that last byte should always be Arry[20]=13
At this point you can make the call:


For A0=0 to 20
serout Mtx,T9600,[Arry[A0]]
Next A0

Immediatly after the call you have to wait the modem acknowledge ">". Here an example of code:

Flag=0
WSend:
Flag=Flag+1
if Flag>20 then NoSMS
Serin MRx,T9600,500,WSend,[ ">"] , A0
If A0=32 then SendTxt
serout Mtx,T9600,[27]
pause 5000
goto NoSMS

The code above will jump to label "SendTxt" if the modem answer corectly, otherwise it will abort the call with ascii 27 and jump to label "NoSMS"

At label "SendTxt" you will wite your code to send your string.

Naturally you should change Serin/Serout to fit your code

Al.

camolas
- 28th October 2008, 21:27
Camola, try the following:

Use a larger array in such a way that you can accomodate the calling string in the initial part of the array:

Arry[0]=65
Arry[1]=84
Arry[2]=43
Arry[3]=67
Arry[4]=77
Arry[5]=71
Arry[6]=83
ArrY[7]=43

The above sequence contains the string AT+CMGS=+

Than you tranfer the sender number (12 bytes) in Arry[8] to Arry[19]. Remember that last byte should always be Arry[20]=13
At this point you can make the call:


Al.

Hi,

Can you please explain this part i do not now how i will put the numbers that i get from the array "numero" to the "Arry" one in ascii.

Thanks,

Xau

camolas
- 28th October 2008, 21:30
Try sending "numero" like you are for "lat" and "Lon", one piece at a time.

Hi,

I will try it then i will post the results.

Thanks,

Xau

mister_e
- 28th October 2008, 21:31
Look the ASCII table

A=65
T=84
and so on

the above could also be written like...



Arry[0]="A"
Arry[1]="T"
// etc etc etc

mackrackit
- 28th October 2008, 21:57
Not sure if this will help you now or not, but it might.
http://www.picbasic.co.uk/forum/showthread.php?t=544

aratti
- 28th October 2008, 22:08
Camolas, The array "numero" contain the string so:

For A0=8 to 19
arry[A0]=numero[A0-8]
next A0
Arry[20]=13

But you can put the value directly in arry[8] to arry[19] instead to put it in the array "numero"

Al.

camolas
- 29th November 2008, 16:41
Hi,

Its final and full working code, any questions please asck.



Code:
--------------------------------------------------------------------------
@ Device HS_OSC
define OSC 20 ' Check the spelling of OSC, must be in capital letter

Include "modedefs.bas" ' Include serial modes

Define LCD_DREG PORTD
Define LCD_DBIT 4
Define LCD_RSREG PORTD
Define LCD_RSBIT 3
Define LCD_EREG PORTD
Define LCD_EBIT 2
Define LCD_COMMANDUS 2000 ' Command Delay (uS)
Define LCD_DATAUS 50 ' Data Delay (uS)
DEFINE LCD_LINES 2 'Number lines on LCD

DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_SPBRG 129 ' 9600 Baud @ 20MHz, 0.16%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically

LCDOut $FE, 1

Clear
sms var byte[10]
numero VAR BYTE[12]
Lat var byte[11]
Long var byte[11]

TrisB.7=0 ' LIGA GSM
TrisB.6=1 ' IGNIÇÃO
TrisB.5=1 ' SENSORES
TrisB.4=0 ' FEXA PORTAS
TrisB.3=0 ' PISCAS
TrisB.2=0 ' IMOBLIZA
TrisB.1=0 ' ?????????????
TrisB.0=0 ' LED OK VERDE

TrisC.4=1 ' RX BT
TrisC.5=0 ' TX BT
TrisC.6=0 ' TX GSM
TrisC.7=1 ' RX GSM

TrisD.1=1 ' RX GPS

Low PortB.1
Low PortB.2
Low PortB.3

Inicio:
Low PortB.0
Pause 500
High PortB.0
Pause 500
Low PortB.0
Pause 500
High PortB.0 'pisca 3 vezez e desliga
Pause 500
Low PortB.0
Pause 500
High PortB.0
Pause 500
Low PortB.0
Pause 2000

UM:
Low PortB.1
HSEROUT["at",13,10]
HSERIN 10000,UM,[WAIT("OK")]
LCDOut $FE, 1,"ON"
HIGH PortB.0

DOIS:
serin2 portD.1, 188, [WAIT("$GPRMC,"),skip 13, STR LAT\11,skip 1, STR Long\12]
High PortB.1


HSEROUT["AT+CMGF=1",13,10]' Modo Texto
HSERIN 10000,UM,[WAIT("OK")]
LCDOut $FE, 1,"ok"

HSEROUT["AT+CMGR=1",13,10] ' Ler sms
HSERIN 5000,UM,[WAIT("REC UNREAD"),skip 3, STR numero\13,skip 27,STR sms\10]


IF sms[0]="S" and sms[1]="t" and sms[2]="o" and sms[3]="p" Then
goto Tranca
Endif

IF sms[0]="C" and sms[1]="e" and sms[2]="l" and sms[3]="i" and sms[4]="a" Then
goto Destranca
Endif

IF sms[0]="P" and sms[1]="o" and sms[2]="s" Then
goto PO
Endif

Goto APAGA

Tranca:
High PortB.3 'Piscas
Pause 500
High PortB.2 ' Imobliza
Goto PO

Destranca:
Low PortB.3 'Piscas
Low PortB.2 ' Imobliza
Goto APAGA

Liga: ' LIGA GSM
High PortB.7
Pause 20000
Goto UM

PO: ' Enia localizacao
HSEROUT["AT+CMGS=",34,STR numero, 34,13]
hserin 10000,PO,[WAIT(">")]

Lo:
HSEROUT["LAT: ",LAT (10),"-", LAT, lat (1),"'",lat (2),Lat(3),".",lat (5),lat(6),lat (7),lat(8),$fe,$c0,"LON: ", Long(11),"-", Long (1),long (2),"'",Long (3),long (4),".",Long (6),long (7),long(8),long (9),13,10]
hserin 10000,lo,[WAIT(">")]

Li:
HSEROUT[26]
hserin 10000,li,[WAIT("OK")]


APAGA:
HSerout ["AT+CMGD=1",13,10]' apaga sms 1
hserin 10000,APAGA,[WAIT("OK")]
HSerout ["AT+CMGD=2",13,10]
Pause 5000
goto Inicio


End
--------------------------------------------------------------------------


Thanks for all the help that you gave me.


Xau.

bethr
- 1st December 2008, 04:25
Your code must hang if there is no enough deposit on the sim card, alternativelay u can see gsm network connectivity available for make more reliable the sms dispachting, i don't know how that cell phone works but if it has log for sms in areas without gsm coverage and the pic still in the Lo loop, once you are back on GSM coverage, simply alll your deposit can be wasted in several hundred SAME message !!

but . . . is just my point of view... :rolleyes:

camolas
- 2nd December 2008, 16:46
Your code must hang if there is no enough deposit on the sim card, alternativelay u can see gsm network connectivity available for make more reliable the sms dispachting, i don't know how that cell phone works but if it has log for sms in areas without gsm coverage and the pic still in the Lo loop, once you are back on GSM coverage, simply alll your deposit can be wasted in several hundred SAME message !!

but . . . is just my point of view... :rolleyes:

Hi,

Thanks for the inputs, for the deposit there is no problem because in my code i delet the "REC UNREAD" sms

"APAGA:
HSerout ["AT+CMGD=1",13,10]' apaga sms 1
hserin 10000,APAGA,[WAIT("OK")]
HSerout ["AT+CMGD=2",13,10]
Pause 5000"

The gsm coverage is very good point that you have made it need to be changed in a futer update.


I have been in a wardware problem now this works very good in a QL200-A4 board but in my home made pcb not (some times works some not..) the pic cant get the phone Tx (i see it in hyperterminal that phone gets the pic Tx e reply but pic cant get it) i have put a 10K pulldown and up in phones Tx but no sucess.Need hellp on that if you mates can hellp me thanks.

Xau.

aratti
- 2nd December 2008, 17:13
Camola, remove the resistors from the serial line and use a Max232.

Al.

camolas
- 2nd December 2008, 19:01
Camola, remove the resistors from the serial line and use a Max232.

Al.

Hi Al,

Ive removed the res and wired like this but no sucess

http://img509.imageshack.us/img509/3451/maxpt7.th.jpg (http://img509.imageshack.us/my.php?image=maxpt7.jpg)

camolas
- 2nd December 2008, 19:03
Camola, remove the resistors from the serial line and use a Max232.

Al.

Hi Al,

Ive removed the res and wired like this but no sucess

<a href="http://imageshack.us"><img src="http://img509.imageshack.us/img509/3451/maxpt7.jpg" border="0" alt="Image Hosted by ImageShack.us"/></a><br/><a href="http://g.imageshack.us/img509/maxpt7.jpg/1/"><img src="http://img509.imageshack.us/img509/maxpt7.jpg/1/w677.png" border="0"></a>

Thanks,

Xau

aratti
- 2nd December 2008, 21:45
Camola, I don't see the pinout in your diagram so I don't know if you have wired it correctly. See the attached schematic for a correct wiring.

Al.

camolas
- 2nd December 2008, 22:15
Camola, I don't see the pinout in your diagram so I don't know if you have wired it correctly. See the attached schematic for a correct wiring.

Al.

Hi Al,

Hare you saying thar i sould conect the max pin 13 to Rx phone and max pin 14 to Tx phone or to nokia data cable 3,2 pins and gnd?
Thanks,

Xau.

aratti
- 2nd December 2008, 23:20
Camola, modem connection should not be crossed (I don't know with nokia) but try, if it doesn't work invert Rx with Tx at the phone cable.

Before to connect the max232 to the phone, make sure that is a standard RS232. If the phone has a 3.3 volts system you will blowup the phone communication line. In this case you should use a different approch.

Remember that if you connect the max232 to the PC serial port then Rx and Tx should be crossed. The connection given in the schematic are for a PC serial connection.

Al.

camolas
- 3rd December 2008, 17:34
Hi,

Didnt work, dont now what to do more.....


Xau

mackrackit
- 3rd December 2008, 23:31
What are the stop bits and parity of a phone?

camolas
- 4th December 2008, 00:04
What are the stop bits and parity of a phone?

Hi,

This is a nokia 6210 and works as 9600,8,N,1

Thanks

mackrackit
- 4th December 2008, 00:28
Have you tried connecting to a PC with a terminal program like the one in Micro Code Studio?

aratti
- 4th December 2008, 13:15
Camola, I am a little confuse. I did a bit of research on google and it seems that
nokia 6210 has a USB connection. Are you sure your phone has a serial connection?

Al.

camolas
- 4th December 2008, 14:32
Have you tried connecting to a PC with a terminal program like the one in Micro Code Studio?

Hi,

I only try whit Hyperterminal with sucess.

Thanks

camolas
- 4th December 2008, 14:35
Camola, I am a little confuse. I did a bit of research on google and it seems that
nokia 6210 has a USB connection. Are you sure your phone has a serial connection?

Al.

Hi,

Yes it have and there are nokia cables to conect it to pc rs232 i have one from nokia and works fine with hyperterminal.

Thanks

mackrackit
- 4th December 2008, 14:45
Hi,

I only try whit Hyperterminal with sucess.

Thanks

Then try SERIN2 in inverted mode for a test. Could be an external hardware problem?

aratti
- 4th December 2008, 15:41
Camola, from your code it seems that you are using portC.6 and PortC.7 for communication with cellphone. If this is correct then:

Connect pic portC.6 to max232 pin 11 (TTL Tx)
Connect pic portC.7 to max232 pin 12 (TTL Rx)
Connect max232 pin 14 to phone serial cable pin 3 (Should be Rx ?)
Connect max232 pin 13 to phone serial cable pin 2 (should be Tx ?)
Connect circuit ground to phone serial cable pin 5

(If you connect it to the PC I assume you have a 9 pins DB female connector)

It should work. If it doesn't invert connections at the serial cable pins 2 & 3

Al.

camolas
- 4th December 2008, 17:31
Then try SERIN2 in inverted mode for a test. Could be an external hardware problem?

Hi,

I have used Serin2 and works not in any 16f877a port it works on B.7 as Rx and in B.6 as Tx.

Serout2 PortB.6, 84,["AT",13,10]
Serin2 PortB.7,84, [wait ("ok")]
High PortB.0

Dont work in C.7 and C6, C4 and C5 big mess.....

Can i used 2 diferents Serin2 and Serout2 in same code because i need to control phone and gps i was using hserin/out to phone and Serin2/out2 for gps.

Thanks

camolas
- 4th December 2008, 17:34
Camola, from your code it seems that you are using portC.6 and PortC.7 for communication with cellphone. If this is correct then:

Connect pic portC.6 to max232 pin 11 (TTL Tx)
Connect pic portC.7 to max232 pin 12 (TTL Rx)
Connect max232 pin 14 to phone serial cable pin 3 (Should be Rx ?)
Connect max232 pin 13 to phone serial cable pin 2 (should be Tx ?)
Connect circuit ground to phone serial cable pin 5

(If you connect it to the PC I assume you have a 9 pins DB female connector)

It should work. If it doesn't invert connections at the serial cable pins 2 & 3

Al.

Hi,

But is not need to give the nokia data cable any power?

Thanks

aratti
- 4th December 2008, 19:24
Yes it have and there are nokia cables to conect it to pc rs232 i have one from nokia and works fine with hyperterminal.

Did you powered the cable working with hyperterminal? If not you don't need to do it with max232.

Al.

camolas
- 4th December 2008, 21:31
Did you powered the cable working with hyperterminal? If not you don't need to do it with max232.

Al.

Hi,

When i use it with the pc hyperterminal there is no need for external power the com port it gives the power that i need it.

Can i use in same code more the one Serout2/in2 on diferent ports to control phone and gps and others serial devices?

Thanks

aratti
- 4th December 2008, 22:39
Can i use in same code more the one Serout2/in2 on diferent ports to control phone and gps and others serial devices?

Yes you can. But when you service one device you don't see the others (If device A will send data while you are servicing device B, device A data will be lost"

Al.

mackrackit
- 4th December 2008, 22:43
Can i use in same code more the one Serout2/in2 on diferent ports to control phone and gps and others serial devices?

I have not done phones, but the others many times.

As long as the pin is set for digital SERIN/OUT/2 will work on any pin that is an I/O, You can have as many pins as you want taking turns doing serial.
You can mix and match SERIN, SERIN2, and HSERIN.
If you are slick, you can HSERIN on the hardware and SEROUT on another.

camolas
- 4th December 2008, 23:34
Yes you can. But when you service one device you don't see the others (If device A will send data while you are servicing device B, device A data will be lost"

Al.

Hi,

Ok thanks for the hellp e will later try ths max way that you told me.

Xau

camolas
- 4th December 2008, 23:36
I have not done phones, but the others many times.

As long as the pin is set for digital SERIN/OUT/2 will work on any pin that is an I/O, You can have as many pins as you want taking turns doing serial.
You can mix and match SERIN, SERIN2, and HSERIN.
If you are slick, you can HSERIN on the hardware and SEROUT on another.

Ok thanks for caring.

Xau

camolas
- 5th December 2008, 20:10
..............

aratti
- 5th December 2008, 20:27
Have you correctly placed the label "UM:" in your code?

Al.

camolas
- 6th December 2008, 00:58
Have you correctly placed the label "UM:" in your code?

Al.

Hi ALL,

Its was a small error its solved, I will post the new code using Serin2/out2.
One more time thank you Sir. for hellping and caring.

Xau

mikebar
- 6th December 2008, 15:17
Hi Camolas,
about the signal coverage, what you think about to use:
AT+CSQ

it should tell you how good is the signal.
In the modem I have it say that
0 - 9 = very poor or not enough
10 - 15 = good
16 - 31 = very good

May this help you.
If you get your code even good for signal coverage, do you like to share it?

linoko
- 9th December 2008, 13:38
HI camolas,
I'm very like your project but i have some question.
Please send me if it is possible the schematic of device and post please the actual source code.
I try earlier version of the source code and i can't see device working.
I connect Siemens S35 the device send AT but cellphone did not answer with OK. Please help me with this project.

Best regards Konstantin
Sofia, Bulgaria

aratti
- 10th December 2008, 22:02
Mikebar, there is no need to waste pic memory space for checking the signal coverage.
The main reason is that the system will use "SMS" for answering and if signal is too poor than modem will not send the message till signal will return to an acceptable level.

---------------------------------------------------------------------------------------------------------------------------------

Linoko, very likely your siemens 35 use only "PDU mode" and you need "TEXT mode".

To check if your phone works in text mode, connect it to hyperteminal and Tx the following command:

AT+CMGF=1

press enter and check the answer.

If answer is "OK" then your phone works also in TEXT mode.

Al.

mikebar
- 11th December 2008, 00:11
Mikebar, there is no need to waste pic memory space for checking the signal coverage.
The main reason is that the system will use "SMS" for answering and if signal is too poor than modem will not send the message till signal will return to an acceptable level.

Al.

Thank you for the info.
But ALL the phones have the same behaviour you described or just some model? it is defined some standard for that behaviour or any producer think is "best solution"?

Thanks in advance.

aratti
- 11th December 2008, 00:39
Yes all phones behave in this way. Try to send a sms to your phone (switched off). You will receive it when your phone will be switched on again.

You can learn more at this link:http://communication.howstuffworks.com/sms.htm

Al.

bethr
- 11th December 2008, 01:06
Mikebar, there is no need to waste pic memory space for checking the signal coverage.
The main reason is that the system will use "SMS" for answering and if signal is too poor than modem will not send the message till signal will return to an acceptable level.


YEP, that's the reason why SMS messages are delayed for minutes hours (carrier dependant) BUT
U must have in mind that SIM card (were SMS are stored by default) has 20 memory location for only SMS if you try to send more, the answer becomes an "ERROR" instead and you wont know what exactly happen, if you really want to know what happen you should check GSM coverage !



Linoko, very likely your siemens 35 use only "PDU mode" and you need "TEXT mode".

To check if your phone works in text mode, connect it to hyperteminal and Tx the following command:

AT+CMGF=1

press enter and check the answer.

If answer is "OK" then your phone works also in TEXT mode.

Al.
please don't forget saving your phone settings using:
AT+CMGF=1 <CR><LF>
AT&W<CR><LF>

mikebar
- 12th December 2008, 00:53
Yes all phones behave in this way. Try to send a sms to your phone (switched off). You will receive it when your phone will be switched on again.

You can learn more at this link:http://communication.howstuffworks.com/sms.htm

Al.

Yes, this is true.
But my guess was another.
Suppose the following scenario:
-I've a mobile phone connected to the PIC
- I wish to send an SMS from that phone
- now suppose that there is not enough rf power to send it.
It is not better to check first if the RF is enough before attempt to send the SMS?

You are talking about to send an SMS to a switched-off mobile. Of course it work because the SMS is sended to your carrier from yuor phone that have enough rf strenght in the moment it is sending the message. Then is your carrier that take care to deliver to the recipient phone as soon it is reachable.
As you can see, I'm talking about a different setup.

Regards.

linoko
- 17th December 2008, 10:07
Hi Friends,
The project of Camolas is very interesting and i try to create my own device. This device /schematic is posted below/ is based on the source code of Camolas with little changes on the source code.
My GSM cellphone is Sony_ericsson T630. The phone supports AT+CMGF=1.

The USART settings are:
DEFINE OSC 20
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_SPBRG 64 ' 19200 Baud @ 20MHz, 0.16%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically

But i have a problem.
The problem is in Hserin command, i thing that the PIC don't recieve or understand the answer (ok) from cellphone.

for example:
TEST:
HSEROUT["AT",13,10]
HSERIN 10000,TEST,WAIT("OK"), the code hangs here
HSEROUT["ATD0897123456",13,10]
High PortB.0

Please help to solve this....


Thank you

mackrackit
- 17th December 2008, 11:01
This is from Camolas' code


HSERIN 10000,UM,[WAIT("OK")]

Your code


HSERIN 10000,TEST,WAIT("OK"), the code hangs here

See the difference in the syntax.

linoko
- 17th December 2008, 12:41
Hi
I correct my code like Camolas code but the result is same

The problem still persisit
Help Please

skimask
- 17th December 2008, 16:18
The project of Camolas is very interesting and i try to create my own device. This device /schematic is posted below/ is based on the source code of Camolas with little changes on the source code.
I don't see where the original poster actually posted working code...so, I can only infer that any code you may have cut/pasted is also flawed.

camolas
- 17th January 2009, 00:54
Hi
I correct my code like Camolas code but the result is same

The problem still persisit
Help Please

Hi,

Dont forget that im using a nokia serial data cable connected to the phone that have to be powerd on the rs232 end and from the data cable connector (the one that connects with the phone) get tx,rx and gnd.
After this try

Serout2 PortB.6, 84,["AT",13,10] ' 84 is for 9600 Baud Rate see what is yours
Serin2 PortB.7,84, [wait ("ok")]
High PortB.0
Any more hellp let me now.

Xau