# RS232 to PIC16f877

Status
Not open for further replies.

#### CHS

##### New Member
Hi everyone... i'm connecting a mobile phone (SE T610) with a DB9 to RS232, meanwhile link to PIC16F877A. The purpose of the project is to dial the phone using AT command written in the PIC whenever the ultra or touch sensor triggered@ PIN_A0 or PIN_A1 triggered. However, i can't seems to have the output transmitted to the mobile phone, can anyone help please? thx...

Is the crystal oscillator @ PIN13 PIN14 of the PIC makes any differences? I'm using a 20MHz crystal series to 2 30pF capacitor.
Below is my program code:

//Preprocessor
#INCLUDE <16F877.H>
#FUSES HS,NOWDT,NOLVP
#USE DELAY(clock=12000000)
#USE RS232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)

#DEFINE OPEN PIN_A0
#DEFINE CLOSED PIN_A1
#DEFINE SIREN1 PIN_B5
#DEFINE LED PIN_B6

char SENSOR1, SENSOR2;

void MAIN()
{ SET_TRIS_A(0x3F);
SET_TRIS_B(0x01);
SET_TRIS_C(0x0E);
SET_TRIS_D(0x00);

SENSOR1=INPUT(OPEN);
SENSOR2=INPUT(CLOSED);

if(SENSOR1)
{
PRINTF("ATD0122121556;\n\r");
OUTPUT_HIGH(SIREN1);
}
else if(SENSOR2)
{
OUTPUT_HIGH(LED);
}
}

The connectivity of MAX232 to my PIC as showned

It would be great if anyone could brighten me up... Thx

#### Diver300

##### Well-Known Member
If you connect the mobile phone to the serial port on a PC, you should be able to get it to dial using the ATD command.

(ATH will hang up)

You can also connect the PIC via the MAX232 to the PC and check that the PIC is sending the command when it should.

You need to get those things sorted before trying the whole system.

#### CHS

##### New Member

I had connected the mobile phone to serial to PC, with the command it works... Testing with a multimeter, i have following output:-
+ve to PIN5 of DB9(ground), -ve to PIN2 of DB9, i have a 5.2V
+ve to PIN5 of DB9(ground), -ve to PIN3 of DB9, i have a 9.6V.
It seems when it work the Rx of DB9 suppose to powered up to 5.2V and Tx up to 9.6V.

But when i fix the connection into RS232 and PIC, i still obtain the 5.2V from PIN2, but the PIN3 have no output at all. Any idea why? The configuration of the rs232 and PIC16f877 shouldn't have caused the problem as i had confirm the same connectivity via alot of references.

It would be a great if u could brighten me up...

Thx...

Regards...

##### New Member
Hello!
Can you please give me schemes for connecting the Sony Ericsson T610 to a PC and to a microcontroller, using serial communication? I tried to search, using google, but i found no relevant results.

Last edited:

I am desperate.

Thanks

#### Wilksey

##### Member
One obvious question would be:
You state a 20MHz crystal, but your delay is:
Code:
#USE DELAY(clock=12000000)

Which sets up your timing up for everything.

Set this to:
Code:
#USE DELAY(clock=20000000)
And see if it makes any difference.

Wilksey

Last edited:

#### fermat7

##### Member
hi...
when dealing with serial RS232 communication, try first to verify the signals compltability
* TTL-CMOS when connecting the chip and the GSM mobile
* try to use Hyper Terminal as a debbuger tool in order to verify the transmission

#### mathewkyle

##### New Member
Help on Phone project

Hello,

Thanks for the info, now i would like to know if this circuit is possible with a NOKIA phone?

Now i would like your help on a project i am working on.

I would like to use a microcontroller (MC) to dial a phone i.e. the MC interfaces with a NOKIA phone. and the MC when it receives a particular input makes the NOKIA phone dial any other phone.

I await eagerly your assistance on this. it is for a class project.

CHS how can i get the code and necessary details for your circuit?

Thanks

Last edited:

#### magnatro

##### New Member
you could reallyus the library provided in the arduino
@ Arduino - HomePage
it contains all the basic codes..

Status
Not open for further replies.

Replies
4
Views
5K
Replies
1
Views
1K
Replies
16
Views
20K
Replies
6
Views
4K
Replies
10
Views
7K