Discussion in "Embedded GSM Development" started by    Alvanbert    Feb 11, 2012.
Tue Mar 27 2012, 03:19 am
#51
I believe Alvanber is right.. adding a prefix and postfix to sms message makes it easy to read and extract it from modem. you can easily look for a special character to start storing and stop storing. saves a lot of buffer space for you.

Please share your work with everyone so its helpful for them to use it.
Tue Mar 27 2012, 03:46 am
#52
@Ajay Below is the code am using to filter the message. The problem is it filters the message required and displays it which is ok. but still in case the lcd characters arent filled, it uses the remaining potion to diplay the whole message again..i.e with date and time. i want it to display only and only the filtered message so that if the message doesnt fill the lcd screen, the remaining part remains blank. Thanks

unsigned char *temp;
temp=msg;
do
msg++;
while(*msg!='#');
msg++;
do
*temp++=*msg++;
while(*msg!='#');
*temp='\0';
Tue Mar 27 2012, 03:01 pm
#53
make two functions first extract the message body from data time etc
after that if u want to filer out the message more than make another function

void read_text( unsigned char *msg,unsigned char *no)   // this function decode the message recieved from modem
{
/*
modem send message in this format
+CMGR: "REC READ" ,"+923335946231","10/10/23,14:29:33+04"
hello

OK
*/

unsigned char *temp;
temp=msg;
do
msg++;
while(*msg!=',');         //  reaching at no
msg++;                    // doing thid because service centre message not start from +
msg++;   
do
*no++=*msg++;
while(*msg!='"');         // reaching at time
*no='\0';
do
msg++;
while(*msg!='\n');
msg++;
do
*temp++=*msg++;
while(*msg!='\r');       // reaching at end of message
*temp='\0';
}


now no has user number
now msg has "hello" according to my example
now if u want to filter out more than make a 2nd function as u make above
Fri Mar 30 2012, 12:37 am
#54
@Majoka i have realised my problem only comes about when i use lcd_data() function to print the message string but if i use the lcd_str() function its okay with the code u gave me.

The problem with using lcd_str(), i cant control where to display part of the string as i would have done with lcd_data() function because with the lcd_data () function i can use a for loop and display string through e.g lcd_data(msg1[i]).


Tue Dec 13 2016, 03:29 am
#55
please what does this mean in the code in this forum
1 #define LCD_EN 0X80
2. #define LCD_RS 0X20
thanks
Tue Dec 13 2016, 02:25 pm
#56
#define LCD_EN 0X80
LCD enable pin is at bit 7 of whatever port it is connected to. e.g. If LCD is connected to P1 then as per macro LCD_EN is connected on P1.7

#define LCD_RS 0X20
similar to LCD en, LCD register select (RS) is connected on bit 5 of port. e.g. P1.5 if port P1.
 rodrider like this.

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

carpinteyrowrl
Fri Apr 19 2024, 02:51 pm
DonaldJAX
Fri Apr 19 2024, 01:08 pm
Lewisuhakeply
Thu Apr 18 2024, 06:00 pm
Darrellciz
Thu Apr 18 2024, 11:07 am
Charlessber
Thu Apr 18 2024, 09:29 am
BartonSem
Thu Apr 18 2024, 04:56 am
DonaldKnown
Thu Apr 18 2024, 12:24 am
utaletxcyw
Wed Apr 17 2024, 10:21 am