Maker Pro
Maker Pro

PIC18F4550 Serial Programming issue

Pieta

Aug 10, 2012
13
Joined
Aug 10, 2012
Messages
13
Ok....

char[0] ='A'
char[1] ='T'
char[2] ='+'
char[3] ='C'
char[4] ='M'
char[5] ='G'
char[6] ='S'
char[7] ='='
char[8] ='"'
char[9] =''"'
char[10] ='+'
char[11] ='8'
char[12] ='1'
char[13] ='8'
char[14] ='9'
char[15] ='3'
char[16] ='3'
char[17] ='0'
char[18] ='2'
char[19] ='2'
char[20] ='2'
char[21] ='\r'

These character will always be fixed for every time...
They need not to be changed any time.

Now comes into picture the actual message that is to be sent to GSM

Lets consider Stop012

As per you have explained above ...

Ques1) Does it means that we will be dealing with the 0 in Stop012 just like above..??

Ques2) if we are sending values like...


char[0] ='S'
char[1] ='T'
char[2] ='O'
char[3] ='P'
char[4] ='0'
char[5] ='1'
char[6] ='2'

This means we are alloting memory to each and every element of array....
So we will also have to unset these values so as to avoid overrunning such a small memory...so which part of code unsets the elements of array after sending to GSM.
 

dahhal

Jul 17, 2012
58
Joined
Jul 17, 2012
Messages
58
A1. Yes you are dealing with it by encoding it with ASCII.

A2. You are already handling this scenario in the function below. You are sending every byte until you hit the null character. don't forget the '\r' if you used this in your testing that worked you will still need it. this is what i suppose the gsm module waits for and part of the AT Command.

void puts(char* p)
{
char *temp = p; /*temp pointer so that the actual pointer is not displaced */
while(*temp != 0x00)
{
putc(*temp);
temp++;
}
}

note: please note I will in a second correct my last post to include '\0' to finish with
 

Pieta

Aug 10, 2012
13
Joined
Aug 10, 2012
Messages
13
Ok..thanks
yes i'll remember the '\r' in the end...its essential

And In case if i have any other issues....i will gently bother you once again...:)
 
Top