Lcd_COut: positioned print, the string is placed in the code memory (a little tricky)
Code: Select all
void Lcd_COut(char row, char col, const char *cptr) {
char chr = 0; //first, it is used as empty string
Lcd_Out(row, col, &chr); //nothing to write but set position.
for ( ; chr = *cptr ; ++cptr ) Lcd_Chr_CP(chr); //out in loop
}
//examples:
Lcd_COut(1, 4, "A constant string");
//or
const char demo[] = "This is also constant";
Lcd_COut(2, 2, demo);
UART1_Write_CText: send a string placed in code memory
Code: Select all
void UART1_Write_CText(const char *cptr) {
char chr;
for ( ; chr = *cptr ; ++cptr ) UART1_Write(chr);
}
//example:
UART1_Write_CText("A constant string");
//or
const char demo[] = "This is also constant";
UART1_Write_CText(demo);
"Manual link for string literals" is also working using const pointers
Greets
IstvanK