View previous topic :: View next topic |
Author |
Message |
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Fri Oct 07, 2011 12:30 pm |
|
|
I think at this point you need to provide a short but FULLY compilable example of your problem.
You are now using a second RS232 stream which mandates you elaborate better on your code.
Do you have any sort of AT command set reference available. If you're not getting the OK it could be because ATQ=1 (which is quiet mode -- which would cause that) ATE0 turns off ECHO. ATQ1 forces the modem to not reply to commands.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Sat Oct 08, 2011 2:44 pm |
|
|
THANKs {bkamen} for help . i will leave this problem and return to it latter . i must go on with the code . |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Wed Oct 12, 2011 11:45 am |
|
|
Do you know how to compare two arrays? I used strcmp but its not working, if the two arrays equal or not the condition will be executed.
Quote: |
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 ?? |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Sat Oct 15, 2011 1:46 pm |
|
|
in the first time it prints the command "AT" but in the second time and more its not printing it why??!!!
Quote: |
void main(){
char string[10];
fprintf(phone,"AT\r");
fgets(string,phone);
fprintf(hyp,string);
delay_ms(2000);
fprintf(phone,"AT\r");//even if i used other commands
fgets(string,phone);
fprintf(hyp,string);//it will not print it
|
|
.
}
|
please tell me why i am going crazy.. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Oct 15, 2011 2:24 pm |
|
|
Trouble-shoot the problem. Debug it. Put in breakpoints. See if the
code ever gets to the last fprintf line.
Put in a loop to display the first 20 characters of the 'string1' array.
Display them as Hex bytes. Then you can examine the bytes and
see what you're really getting. This post shows to display the contents
of array in Hex format:
http://www.ccsinfo.com/forum/viewtopic.php?t=29899&start=1
In other words, stop working a such a high level in which you can't
figure out what is happening. Get yourself mentally into "Debug" mode.
Check if the code is really executing. Check what you are really getting
as input data in your arrays. Check everything until you find out what
the problem is. |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Sun Oct 16, 2011 9:40 am |
|
|
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...? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Oct 16, 2011 2:32 pm |
|
|
I don't have Proteus and don't want it. I think that very few people on
here want to trouble-shoot problems that may involve Proteus bugs.
We want to solve coding bugs and CCS bugs, and some hardware bugs,
but not Proteus bugs.
With regard to your last reply, you completely ignored the trouble-shooting
suggestions in my post, and you just re-stated your problem again.
Doing that is not going to solve your problem.
You must learn how to trouble-shoot (debug) a problem.
And you must do it. |
|
|
cse307
Joined: 03 Oct 2011 Posts: 25
|
|
Posted: Tue Oct 18, 2011 2:16 pm |
|
|
PCM programmer wrote: | I don't have Proteus and don't want it. I think that very few people on
here want to trouble-shoot problems that may involve Proteus bugs.
We want to solve coding bugs and CCS bugs, and some hardware bugs,
but not Proteus bugs.
With regard to your last reply, you completely ignored the trouble-shooting
suggestions in my post, and you just re-stated your problem again.
Doing that is not going to solve your problem.
You must learn how to trouble-shoot (debug) a problem.
And you must do it. |
i don't know how to debug using your way or debug in any way.but i did not stop i made some experiments and i almost solved the problem .i still do not know where was the wrong and why but its working.
thanks for help |
|
|
|