I need to receive message from GSM via UART. I need to display this message at GLCD.
The problem were:
1. first i have to prepapare the empty string without character e.gchar *someText ( someText=" "))
2. when the received SMS message is short ( Less than 15 character the value display contains garbage character(unknown character).
How can i remove the garbage character.
Part of the codes that i have modified from the orinial "GSM SMS" example, as below;
Code: Select all
char *someText;
void main:
---------------
someText = " ";
while (1)
---------
Glcd_Fill(0x00);
Glcd_Set_Font(font5x7, 5, 7, 32); // Choose font, see __Lib_GLCDFonts.c in Uses folder
Glcd_Write_Text(someText, 0, 0, 2);
---------
}
void interrupt() {
------
------
switch (gsm_state) {
case 0: {-----------
----------
if (tmp == 'Z')
gsm_state = 40; i=0;
----------
case 40: {
someText[i] = tmp; i ++;
if (i < 15) { gsm_state = 40; }
if (i>=15){gsm_state=0;i=0;check=~check;}
if(tmp=='/'){ for (i = i; i < 15; i ++){
someText[i] = '0';} // clear display
if (i >= 15) {gsm_state=0;i=0;check=~check; } }
}; break;