|
|
View previous topic :: View next topic |
Author |
Message |
vjn86
Joined: 12 Oct 2009 Posts: 11
|
can't read & compare data needed for reading sms functio |
Posted: Fri Dec 25, 2009 9:17 am |
|
|
Hi all, I am trying to write a program that read incoming sms from a GSM modem and sends back a acknowledgment message to the defined number. The acknowledgment message named "hey" should be sent if the mydata[] and mydata1[] are equal and it should send "error" if it isn't equal.
If I define both array:
as equal :
( mydata [] = test ;mydata1[]= test)
or
not equal:
( mydata [] = test ;mydata1[]= testing),
I'm able to get desired output... The problem starts when i try to compare a stream named mydata[] and defined string named mydata1[]= "+CMTI: \"SM\",1/n" as shown in coding. When i use this, I'm not even getting a error message.... What am i possibly wrong at ?
p/s : If I receiving message at location 1, the indication is +CMTI: "SM",1
thanks
Code: |
#use delay(clock=20000000)
#fuses hs,nowdt,nolvp,noprotect
#use rs232(baud=9600, bits=8, parity=N, stop=1, xmit=PIN_C6, rcv=PIN_C7, stream=mydata[],)
void main()
{
char mydata[];
char mydata1[]= "+CMTI: \"SM\",1/n";
set_tris_c(0x80);
printf("at\r\n");
delay_ms(500);
gets(mydata);
if(strcmp (mydata,mydata1)==0)
{
printf("at+cmgf=1\r\n");
delay_ms(500);
printf("at+csmp=17,168,0,0\r\n");
delay_ms(500);
printf("at+cmgs=\"+60136240915\"\r\n");
delay_ms(3000);
printf("hey ");
putc(0x1A);
delay_ms(10000);
}
else
{
printf("at+cmgf=1\r\n");
delay_ms(500);
printf("at+csmp=17,168,0,0\r\n");
delay_ms(500);
printf("at+cmgs=\"+60136240915\"\r\n");
delay_ms(3000);
printf("error ");
putc(0x1A);
delay_ms(10000);
}
}
|
|
|
|
vjn86
Joined: 12 Oct 2009 Posts: 11
|
|
Posted: Sun Jan 24, 2010 12:32 pm |
|
|
erm..can't anyone advice me what to do next ? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jan 24, 2010 12:48 pm |
|
|
Where's the size on this ? You have allocated a pointer, but no storage
locations.
Here you're filling up memory locations, starting at the pointer address,
but the memory locations don't belong to the array. They could belong
to anything else. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|