Reply To: Retrieving UART data on LCD using PIC16F877A

Home Forums Microcontrollers PIC Microcontroller Retrieving UART data on LCD using PIC16F877A Reply To: Retrieving UART data on LCD using PIC16F877A

#11506
Guderz90
Participant

Thanks

My RAM usage is 30% (70% is free). I used this copy2Ram method to reduce my RAM usage. Maybe it might be one of the causes.

Below is the method I used and how the code would look like:

const char UART_txt1[] = "AT";
const char UART_txt2[] = "AT+CMGF=1";
const char UART_txt3[] = "AT+CMGS=\"0772166326\"";
const char UART_txt4[] = "Patient has fallen, provide assistance";

//..................................................................................................................

char * CopyConst2Ram(char * dest, const char * src)
{
  char * d ;
  d = dest;
  for(;*dest++ = *src++;);
  return d;
}
//..................................................................................................................

UART1_Write_Text(CopyConst2Ram(msg, UART_txt1));
UART1_Write(0X0D);
Delay_ms(1000);
UART1_Write_Text(CopyConst2Ram(msg, UART_txt9));
UART1_Write(0X0D);
Delay_ms(1000);
UART1_Write_Text(CopyConst2Ram(msg, UART_txt2));
UART1_Write(0X0D);
Delay_ms(1000);
UART1_Write_Text(CopyConst2Ram(msg, UART_txt3));
UART1_Write(0X0D);
UART1_Write_Text(CopyConst2Ram(msg, UART_txt5));
UART1_Write(0X1A);
UART1_Write(0X0D);
Delay_ms(4000);
>