# Problems reading AT commands with PDU mode (PIC16F877A and T68i phone)

Status
Not open for further replies.

#### lloydi12345

##### Member level 4
Hi, We have a project and it is a sms based microcontroller. I'm using Sony Ericsson T68i for the phone and I'm using PDU format. Testing everything on hyperterminal seems alright. Now, going to simulation, programming on mikroC PRO and using a virtual serial port I was able to receive a response from the phone using only the usb data cable. I send "AT" to the phone using the uC and I was able to receive "AT and "OK" from it. The program runs fine but it does not really run on the way it should be. The problem is, the microcontroller doesn't seem to read the "OK" data which is parsed at the bottom of the program. If it is properly read, the 8th pin of portb should light the LED. Can you help me clear the problem?

This code below is working only until the 2nd character which is "T"
Code:
unsigned char recv[9];
int x;

void main() {
portb = 0x00;
cmcon = 0x07;
trisb = 0x00;

uart1_init(9600);
delay_ms(1000);

uart1_write_text("AT");
uart1_write(10);  //line feed
uart1_write(13);    //carriage return
delay_ms(500);

for (x=0; x<9; x++){
if (recv[0] == 'A' && recv[1] == 'T'){
portb.f7 = 1;    //ouput led on
}
else {
delay_ms(100);
}
}
}

when I change the condition statement to this
Code:
if (recv[0] == 'A' && recv[1] == 'T' && recv[2] == '\n' && recv[3] == '\r' && recv[4] == 'O' && recv[5] == 'K' && recv[6] == '\n' && recv[7] == '\r')

It won't work. I don't know if it's right. I attached an image how the reply looks. This is the only idea I know how to check the "OK" data sent by the phone. If you have any other alternatives I would really be so thankful.

#### lloydi12345

##### Member level 4
Guys I am now able to communicate the Microcontroller and the phone but the problem is it is only simplex. I can only send text messages but not read. The connections I only used were RX, TX and GND pin of the phone. Can you help me how to read messages from the phone? Please?

#### olumide.toyosi

##### Newbie level 4
Guys I am now able to communicate the Microcontroller and the phone but the problem is it is only simplex. I can only send text messages but not read. The connections I only used were RX, TX and GND pin of the phone. Can you help me how to read messages from the phone? Please?

Hi, pls i use CCS PIC C compiler, could u send a sample code for sending sms?
if u don't know how to use PIC C u can write it in mikroC i'll interprete it. thanks.
the phone i'm using is sony ericsson T68i too.

Also, is it necessary to use MAX232 to interface the phone with PIC16F877A?

Last edited:

Status
Not open for further replies.

Replies
23
Views
6K
Replies
3
Views
2K
Replies
9
Views
7K
Replies
0
Views
820
Replies
11
Views
2K