PDA

View Full Version : Help me about communicating PIC with cellular phone...



d_hamen
- 1st November 2006, 17:12
Hi, i have to communicate PIC 16F877 with my Nokia 7250i mobile phone. I want to make a call by using PIC. But there's a problem i couldn't solve. I sent the link of the schematic of circuit, and wrote my codes below. Waiting for your help...

<img src="http://images.elektroda.net/31_1162337687.jpg">


INCLUDE "modedefs.bas"

' ******* Definitions *******
' ------------------------------

DEFINE OSC 10 ' Define clock Oscillator Frequency at 10Mhz
DEFINE HSER_RCSTA 90H ' Enable Hardware USART receive
DEFINE HSER_TXSTA 24H ' Set Hardware USART parameters
DEFINE HSER_BAUD 9600 ' Set baud rate to 9600
define HSER_CLROERR 1


OUTPUT PORTC.6
INPUT PORTC.7

PORTC = %00000000 ' Initial state of PORT C

Start:
PAUSE 1000
HSerout ["atD05354511850"]

goto start

end

keithdoxey
- 1st November 2006, 18:42
Is anyone else thinking "MAX232" ???

sayzer
- 1st November 2006, 18:46
Also, is anyone else thinking about doing some search?

This forum has so many examples that most of the time makes me surprised.

What a treasure we have here!



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

dhouston
- 1st November 2006, 19:47
Try cross-connecting TX & RX. That is, PIC-RX to Nokia-TX and vice versa. If you need to invert the logic (likely), see...http://www.picbasic.co.uk/forum/showthread.php?t=4778or you could use two other of the PIC's pins and use SerIn & SerOUt so you can set the logic to inverted.

If the Nokia uses RS232 voltage levels (unlikely) you need current limiting resistors in the TX & RX lines. See the PBP manual pages for SerIn, SerOut.

d_hamen
- 2nd November 2006, 13:31
Yes I had cross connected RX and TX of the phone and pic. I don't think the problem is because of it.

Nokia is working with TTL Logic so it gives high for 3.3v (so 5volt too) and low for 0 volts; So I think max232 is not needed to use here. Because it is using for RS232 which is working with 12Volt.

dhouston
- 2nd November 2006, 16:44
Yes I had cross connected RX and TX of the phone and pic. I don't think the problem is because of it.

Nokia is working with TTL Logic so it gives high for 3.3v (so 5volt too) and low for 0 volts; So I think max232 is not needed to use here. Because it is using for RS232 which is working with 12Volt.

You still need to invert the logic. The PIC UART is uninverted. You either need to use SerIn/SerOut so you can invert in your firmware or you need to add two inverters (e.g. using the comparators as suggested in the link I gave earlier).

I'm not sure what you mean by "so 5volt too" but 3.3V is inadequate if you are using the PIC at 5V Vdd. Port C has Schmidt Trigger buffers which need 0.8*Vdd for a logic High (0.8*5V=4V). If you use SerIn/SerOut or DebugIn/Debug on pins that have TTL buffers, 3.3V should be OK.

dhouston
- 2nd November 2006, 21:24
Are you sure about those 7250i pins? Everything I can find indicates the 7250i has USB and IR but there's nary a mention of a serial connection.

What is FBus?

d_hamen
- 4th November 2006, 07:44
FBUS is a protocol that nokia phones are using. It is same as AT commands but a bit complex.
I made the program as you said. but it doesn't work. FBus Rx&Tx means it is supported for serial connection for Nokia 7250i.


INCLUDE "modedefs.bas"

DEFINE OSC 4 ' Define clock Oscillator Frequency at 4Mhz
DEFINE HSER_CLROERR 0

OUTPUT PORTc.6
INPUT PORTc.7
PORTc = %00000000 ' Initial state of PORT C


Main:

' Make a call

serout2 portC.6, T9600, ["ATZ",13,10] ' Reset the phone
Pause 1000

serout2 portC.6, T9600, ["ATDT",34,"+905448515247",59,34,",129",13,10] ' Make a call for 15 sec.s 59 is ;
PAUSE 15000

serout2 portC.6, T2400, ["AT",13,10] ' Finish the call
PAUSE 1000

GOTO Main

END


Thanks...

sayzer
- 4th November 2006, 11:33
Himmm,

I now where this phone number comes from!

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

dhouston
- 4th November 2006, 15:11
You need INVERTED logic -try N2400.

And, assuming you use +5V to power the PIC, you are still using PortC which needs 4V for a logic high so the 3.3V from the Nokia will not be detected. Look at the Electrical Characteristics section of the datasheet.

Do you have a URL that explains the FBus connections and protocol?

dhouston
- 5th November 2006, 02:52
I found numerous links about F-Bus. If they are accurate, you are pretty far off base.http://www.embedtronics.com/nokia/fbus.html#part1 It runs at 115200bps. Here's a schematic of the interface hardware...http://www.panuworld.net/nuukiaworld/hardware/cables/fbus.htm

d_hamen
- 5th November 2006, 10:53
Yes I read them. I know; FBus works with 115200 bps but I read the thread of "hserin, hserout problems" and I saw that they are all using FBus with 9600 bps. (If I did not misunderstand them :( )

You said "you are still using PortC which needs 4V for a logic high so the 3.3V from the Nokia will not be detected"

I used a resistor between them. And the voltage across the phone's Rx is nearly 3.5Volt. İs it again a problem if yes;

what must I do then? choose a different port?


Thaks so much...

dhouston
- 5th November 2006, 12:53
You said "you are still using PortC which needs 4V for a logic high so the 3.3V from the Nokia will not be detected"

I used a resistor between them. And the voltage across the phone's Rx is nearly 3.5Volt. İs it again a problem if yes; what must I do then? choose a different port?Yes. Look at DO40 & DO41 (Vih) Input High Voltage in the Electrical Characteristics section of the datasheet for your PIC. Ports with a Schmidt Trigger buffer (e.g. PortC) need 0.8*Vdd (4V with Vdd=5V) while ports with a TTL buffer (e.g. PortB, some PortA pins) only need 2.0V. See the I/O Ports section for buffer types.

Note that while you can omit the MAX232 (which, in addition to converting voltage levels, inverts the logic) you still need to invert the logic.

Unless the Nokia has auto-baud detection, you either need 115200 or need to send some (?) command to set the baud rate in the Nokia.

d_hamen
- 22nd November 2006, 09:00
Hi d_houston;

I have lots of exams for a week.So; Because of my lectures I had to study and couldn't connect to the internet.

Yesterday I bought ericsson A1018s and used it in my project. Also I changed some of my hardware too. (I changed pic and crystal)

And result is perfect! It is working now. I used HSERIN and HSEROUT commands according to serout2, serin2 and I did not inverted. I don't use max232. I directly connect phone's pins to the pic. Now I am trying to make a control system with sms. For example when you send sms "led1" to pic's ericsson phone then first led will light in the circuit.

Thanks for your help d_houston...

Good works