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.

AT COMMANDS IN mikroC via UART: using SET230 phone

Status
Not open for further replies.

thedemme

Newbie level 3
Joined
Feb 8, 2010
Messages
4
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,283
Activity points
1,320
Hi!....
How to read a message on the phone using AT Commands via the UART of p16f877A and displays it on PORTB?......


I'm using P16F877A and SONY ERICSON T230 phone...


Here's my code.... It's not actually working, but I'm still working on it....

Initially, the message storage in the phone memory is empty and the program tries to read and read and read until there is such a message located at index 1 in the message storage.... It reads the message and displays it in PORTB.... Assuming that the text message received is "1", the value of PORTB should also be 1... And then, finally, it deletes the message to make the message memory empty for the next message to be read, the same manner as the first text message....






Code:
unsigned char* MSG1 = "AT+CPMS=\"ME\"\n";
unsigned char* MSG2 = "AT+CMGR=1";
unsigned char* MSG3 = "AT+CMGD=1";
unsigned char* MSG4 = "\r";
char message;

void main() {
int ctr;
TRISD= 0x00;
TRISB=0x00;



UART1_Init(9600); // Initialize UART module 9600 bps

while(1)
{
for(ctr=0;ctr<3;ctr++)
{
PORTB = 0X01; // Test to see if programme

started running.
Delay_ms(1000);
PORTB = 0;
Delay_ms(1000);
}



UART1_Write_Text(MSG1); //selects the storage to be read as the

phone memory
Delay_ms(1000);

UART1_Write_Text(MSG4); // ENTER
Delay_ms(1000);

UART1_Write_Text(MSG2); // Command for reading message on the

phone memory at index 1;
Delay_ms(1000);

UART1_Write_Text(MSG4); // ENTER
Delay_ms(2000);



if(UART1_Data_Ready()==1)
{
message = UART1_Read();
}

PORTB = message; //dISLAYS the message received in PORTB

// The message should be "1", "2", Or "4"








for(ctr=0;ctr<3;ctr++) //end of program execution
{
PORTB = 0X01;
Delay_ms(1000);
PORTB = 0;
Delay_ms(1000);
}

}





}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top