Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

Status
Not open for further replies.

lloydi12345

Member level 4
Joined
Aug 31, 2010
Messages
77
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,288
Activity points
1,953
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;
   adcon1 = 0x06;
   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++){
   while (uart1_data_ready()== 0){;}
         recv[x] = uart1_read();
       //check if response received
        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.

 

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? :(
 

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.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top