how to put characters in an array

Thread Starter

Gerelectronic

Joined Mar 3, 2021
8
Hello everybody.
I'm trying to build a gps monitoring system.
My problem is that I can't store continuously varying characters within an array.
The array must contain the set of characters that will subsequently be printed on an LCD screen.
the code excerpt is this:

while (! UART1_Data_Ready ());
Temp = UART1_Read (); // skip the first comma
Lcd_Cmd (_LCD_FIRST_ROW);
Lcd_Out_Cp ("UTC:"); // displaying UTC on LCD
while (Temp! = ',')
{
Lcd_Chr_Cp (Temp); // Displaying Time on LCD
while (! UART1_Data_Ready ());
Temp = UART1_Read ();
Index ++;
if (Index == 2 || Index == 4)
Lcd_Chr_Cp (':');
}
lcd_cmd (_lcd_clear);
Index = 0;

what I would like to do is something like this:

while (! UART1_Data_Ready ());
Temp = UART1_Read (); // skip the first comma
Lcd_Cmd (_LCD_FIRST_ROW);
Lcd_Out_Cp ("UTC:"); // displaying UTC on LCD
while (Temp! = ',')
{
array [] = Temp;
while (! UART1_Data_Ready ());
Temp = UART1_Read ();
Index ++;
if (Index == 2 || Index == 4)
Lcd_Chr_Cp (':');
}
lcd_out (1,1, array []);
lcd_cmd (_lcd_clear);
Index = 0;

Only doing it this way doesn't work at all
and I can't figure out how to do it. :(
i made this code in Mikroc with pic 16f877a.
I have also attached all the original code and the proteus program.
A sincere thanks to all those who will try to give me a hand.
Sorry for the poor English.
Thank you all.
Long live electronics :)
Thanks again.
 

Attachments

ericgibbs

Joined Jan 29, 2010
13,614
hi G,
One option is to capture the full GPS serial message string, then parse out the parameters of interest and print out to the LCD display.
Use the location of the 'comma' separators, to locate the parameters in the sting buffer.

The captured message will remain in the Serial buffer until the next GPS string is read.

Look at this link.
E
https://forum.mikroe.com/viewtopic.php?t=27070
 
Top