View previous topic :: View next topic |
Author |
Message |
cse307
Joined: 03 Oct 2011 Posts: 25
|
HELP:: i do not know how to deal with AT command |
Posted: Mon Oct 03, 2011 4:29 pm |
|
|
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-------------------- |
|
|
bungee-
Joined: 27 Jun 2007 Posts: 206
|
|
Posted: Mon Oct 03, 2011 5:35 pm |
|
|
Start first with:
Code: | #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=PORT1) |
And then with something like:
And finally you have to catch the answer from phone
And you have to do something with that..... But seriously your question is very cryptic so it's hard to understand what you really want. |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Tue Oct 04, 2011 11:50 am |
|
|
bungee- wrote: | Start first with:
Code: | #use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=PORT1) |
And then with something like:
And finally you have to catch the answer from phone
And you have to do something with that..... But seriously your question is very cryptic so it's hard to understand what you really want. |
Can you please write a full code starting from #include TO end void main for sending "AT" and receiving OK.
Is there a program or simulator that can make a virtual connection between my code(PIC16f877a) and the real cellphone(T68i) to check if the code is working well because i do not have a programmer.
And if i write a code i will not know if it well work latter. As you know the time is critical for my graduation project.
I do not know if Proteus simulator can do the virtual connection between them if it does i don't know how.
What is the commands that i will use to communicate with cellphone using the AT command (e.g. printf .....etc).
-------------------------------THANKs--------------------------------- |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Tue Oct 04, 2011 1:53 pm |
|
|
Sigh....another last minute project...what level of education are you in ??
First off Proteus is full of bugs,errors and faulty DRCs...so good luck finding ANYONE who can properly diagnose WHERE your problems are...
hint.
You will have to add 'errors' to the use rs232(...) options...
hint.
try Google.Given the right combination of keywords IT will find complete working code(took .42 seconds, 135,000 hits)
hint.
you will not learn a thing stealing code off the web, you should have read and done labs
hint.
setting up a PIC under CCS C to interface with a cell phone requires less than 100 lines of sourcecode( 2 written pages). |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Thu Oct 06, 2011 11:09 am |
|
|
which program you recommend then??
what do you mean with :
Quote: |
hint. setting up a PIC under CCS C to interface with a cell phone requires less than 100 lines of sourcecode( 2 written pages). |
if you can help just help. |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Thu Oct 06, 2011 6:36 pm |
|
|
i need a full program for sending "AT" to mobile and check if "OK" is received. to check the status of mobile.
.......THANKs.... |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Thu Oct 06, 2011 9:45 pm |
|
|
cse307 wrote: | i need a full program for sending "AT" to mobile and check if "OK" is received. to check the status of mobile.
|
Translation: I need someone else to do this for me.
(sigh) _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Fri Oct 07, 2011 6:27 am |
|
|
You have spent 3 days asking for a program that takes less than 1 day to write for a moderate programmer. Even the hint to use Google did not move you into action.
Here on this forum we want to help you solve a programming problem but we are not going to do all the work for you. Personally I rather have you fail school than to graduate with a stolen program, I have enough devices at home with buggy software written by incompetent programmers.
Let us see you have put some effort into the project. Post the program as far as you have it and we will you hints to complete the program. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Fri Oct 07, 2011 8:12 am |
|
|
Please post your school's name,city, and course/year that requires this project.It'd be interesting for some of us 'regulars' to know that info.
As for helping you, as previously stated, there is TONS of code 'out there' in cyberspace, but if you want my working code, it'll cost you a nominal $1 per line of code,less than 1/3 my going rate.I would require all hardware(cellphone, cables, etc.) first to confirm the code works 100% though. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Fri Oct 07, 2011 9:16 am |
|
|
You guys crack me up with your bulls-eye comments. _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Fri Oct 07, 2011 9:42 am |
|
|
i am sorry i did not clear my point view. i did write a program do that but i think its too long to give the write result i just wanted the professional experience to do it more reliable and smaller this is my code :
Quote: |
void main(){
char string[11], ok[3];
strcpy(ok, "OK");
delay_ms(500);
fprintf(phone,"AT\r");
string[0]=fgetc(phone);string[1]=fgetc(phone);
string[0]=fgetc(phone);string[1]=fgetc(phone);
string[0]=fgetc(phone);string[0]=fgetc(phone);
string[1]=fgetc(phone);
if(!strcmp(string, ok)){
|
i am very sorry .i am still new in this things:( THANKs ): |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Fri Oct 07, 2011 10:04 am |
|
|
cse307 wrote: |
Code: |
void main(){
char string[11], ok[3];
strcpy(ok, "OK");
delay_ms(500);
fprintf(phone,"AT\r");
string[0]=fgetc(phone);string[1]=fgetc(phone);
string[0]=fgetc(phone);string[1]=fgetc(phone);
string[0]=fgetc(phone);string[0]=fgetc(phone);
string[1]=fgetc(phone);
if(!strcmp(string, ok)){
|
|
I don't know why you need a 1/2sec pause between copying a string..
but anyway...
You can do a:
gets(string, phone); // See compiler help
to do all that work for you (which if you look, is messed up because the index is incorrectly numbered which won't work of course)
I would recommend NOT pausing at all between the sent of the "AT\n" and the gets(); so as to not jam up the receive buffer with too many chars.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Fri Oct 07, 2011 10:46 am |
|
|
i do not know why i added "delay_ms(500)" just forget it. the thing is that using Quote: | gets(string, phone); | it will get the "AT" not "OK" becouse when the mobile phone receive "AT" it will reply first by "AT" and cr"\r" then it will reply by "OK\r". using my code string will get the "OK" not "AT". is there some method to do that more shortly.
THANKs |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Fri Oct 07, 2011 10:54 am |
|
|
ATE0 (that's a zero not the letter O) is your friend. (turns off local echo)
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Fri Oct 07, 2011 12:16 pm |
|
|
Quote: | fprintf(phone,"ATE0\r");
delay_ms(2000);
fprintf(phone,"AT\r");
fgets(string,phone);
fprintf(hyp,string);
|
BUT Quote: | fprintf(hyp,string); |
print nothing on hyperterminal ???! it must print "OK".. |
|
|
|