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.

PIC16f877a and AT command using CCS C compiler

Status
Not open for further replies.

khaldun904

Junior Member level 2
Joined
Sep 30, 2010
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,423
Hi;

I am using pic16f877a to communicate with T68i Sony Ericsson and i do not know how to do that using at command in the CCS C Compiler. I am using Proteus simulation program to connect between virtual PIC (Code program) and the real phone (T68). First I need a program sends "AT" and receive "OK" to know that the connection is exists and if there is a guide to learn how to deal with AT command using CCS C.

note: I am using bluetooth to connect the t68i to PC and get a port number(COM) which used to enter it to the rs232(COMPIM) to connect it.

see: in image.google (proteus rs232 )

-------------------please help its for my graduation project--------------------
 

can you write a full program for sending "AT" and and check if "OK" is received.

THANKs
 

i need a full program for sending "AT" to mobile and check if "OK" is received. to check the status of mobile. using CCS C compiler


.......THANKs....
 

any body know a code that receive the reply from the cellphone not the echo.(eg. "AT" receive "OK" not another "AT").

thanks
 

Nobody will write you a code.
The step is, you must learn sending UART and receive UART. I'm not use CCS but use Hi-Tech.
 

Hi;

I am using pic16f877a to communicate with T68i Sony Ericsson and i do not know how to do that using at command in the CCS C Compiler. I am using Proteus simulation program to connect between virtual PIC (Code program) and the real phone (T68). First I need a program sends "AT" and receive "OK" to know that the connection is exists and if there is a guide to learn how to deal with AT command using CCS C.

note: I am using bluetooth to connect the t68i to PC and get a port number(COM) which used to enter it to the rs232(COMPIM) to connect it.

see: in image.google (proteus rs232 )

-------------------please help its for my graduation project--------------------

Which is the operating system you using?. In windows xp you will find the comport in the bluetooth properties. Fist you need to pair the device to the pc. Then you will see the device in bluetooth properties. Select it and select the tab of services it will give you the comport. First you need to know the USART module of pic micro controller. Then send the data to the phone. If any problems occured post here. Sure i'll help you. Because i did that project several times.
 

Hi; I am using pic16f877a to communicate with T68i Sony Ericsson and i do not know how to do that using at command in the CCS C Compiler. I am using Proteus simulation program to connect between virtual PIC (Code program) and the real phone (T68). First I need a program sends "AT" and receive "OK" to know that the connection is exists and if there is a guide to learn how to deal with AT command using CCS C. note: I am using bluetooth to connect the t68i to PC and get a port number(COM) which used to enter it to the rs232(COMPIM) to connect it. see: in image.google (proteus rs232 ) -------------------please help its for my graduation project--------------------[/QUOTE said:
First of all you have to be sure that your RS232 circuits is functioning well. And two of your problems are to test if you can communicate with your cellphone using AT commands and remove echo thus you want to see a reply of OK from AT. Here's how you do it:
First connect your cell phone to your computer, then press the windows logo on your keyboard or click start, go to Accessories --->
Communications ----> and click Hyper terminal. Fill required data, then when a window pop-out click New Connection, then set:

BAUD Rate:9,600 to 115,200 bps
Data bits:8
Parity:NONE
Stop Bits:1
Flow Control:NONE

Type in the keyboard the following:
AT[ENTER], see the reply...
ATEO[ENTER], THis command removes echo, and then type again AT[ENTER], and you will see OK only.

YOu can translate this command into the CCS C programming, for example,
printf("at\r"); //a command to type AT.
You need to learn to program by yourself.

Headman
 

Do you know how to compare two strings i used strcmp but its not working if the two arrays equal or not the condition will be excuted

char string[20];char string1[]="NO CARRIER";

if(strcmp(string,string1))//string=NO CARRIER
fprintf(hyp,string);//always executed even if string1=NO for example !!??

is the syntax correct or is there another function i can use ??
 

I am using Proteus simulator to connect the pic and the cellphone. I am using three hyperterminal two to see the output from the pic and input to pic{from cellphone} and one act as PC(hyp). When I use this code to send "AT" for example, the fprintf(hyp--) will print just one AT. Another thing is that the fprintf(phone--) will send just three commands only and then stop sending.


Code:
char string[10];

while(1){
fprintf(phone,"AT\r");
fgets(string,phone);
fprintf(hyp,string);

delay_ms(2000);
}

I don't know why is the problem in the program...?
 

I am using Proteus simulator to connect the pic and the cellphone. I am using three hyperterminal two to see the output from the pic and input to pic{from cellphone} and one act as PC(hyp). When I use this code to send "AT" for example, the fprintf(hyp--) will print just one AT. Another thing is that the fprintf(phone--) will send just three commands only and then stop sending.


Code:
char string[10];

while(1){
fprintf(phone,"AT\r");
fgets(string,phone);
fprintf(hyp,string);

delay_ms(2000);
}


I don't know why is the problem in the program...?

What are you trying to achieve? and what is the purpose of this project so that I can tell you if it is ok to use a string or not?
 

What are you trying to achieve? and what is the purpose of this project so that I can tell you if it is ok to use a string or not?

i want to send "AT*ECAM=1" or "AT+CPAS" to see the phone activity status if its active or not. this is my main purpose. so if its active i will write a condition to make something .

i will be very pleased if you helped me. thanks
 

i want to send "AT*ECAM=1" or "AT+CPAS" to see the phone activity status if its active or not. this is my main purpose. so if its active i will write a condition to make something .

i will be very pleased if you helped me. thanks

As long as the phone has power it is active. If your project is interactive, meaning that your phone takes a command and execute it, and it can reply to the sender whoever texted the phone and it replies to the sender automatically through your programming. I don't see the need to check if its active or not and using string may not be possible because you can program it to delete, store, and send data continuously.

Does your project includes reading a message on its inbox?
 

As long as the phone has power it is active. If your project is interactive, meaning that your phone takes a command and execute it, and it can reply to the sender whoever texted the phone and it replies to the sender automatically through your programming. I don't see the need to check if its active or not and using string may not be possible because you can program it to delete, store, and send data continuously.

thanks for reply;

i must and i need to use these commands in my project for now and later purpose. for example to check if the receiver cell phone is closed or not and if he have the phone with him(near to him) by checking if he answers the call or not and then hang up.

Does your project includes reading a message on its inbox?

yes, i will use pic to read a message from cell phone and write message on the cellphone.(i will do it later and i will be pleased and grateful if you helped me to do it )

please can you tell me how to monitor the answer from cellphone using the AT command sent by the PIC the command is :

"AT*ECAM=1" : this command will activated once and check the call activity if it calling or answer..etc.

THANKs
 

I've use PIV16F877A to Siemens C35,C45 Mobile phone. It's work fine.

Sample code

// RX DATA

#INT_RDA
void READ_RS232(){
char c;
c=getc(GSM);
//fprintf(DEBUG"%c",c);
buffer[buffer_index] = c;

buffer_index++;
setup_timer_1(T1_INTERNAL | T1_DIV_BY_8);
set_timer1(49910); // Timeout = 50 ms
}



//TX DATA

fprintf(GSM,"AT\r\n");
delay_ms(1000);
fprintf(GSM,"AT+CNMI=1,1,2,2,1\r\n");
delay_ms(1000);
fprintf(GSM,"AT+CSCB=1\r\n");
delay_ms(1000);
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top