Here is an example of printing the special characters “, \, and % in ‘C’ strings using our API.
void demoSpecialChars(void)
{
char buf[120];
sprintf(buf,”f 24″); // set font size 24
sendToSerialPort(buf);
sprintf(buf,”s 0 1″); // set black on white
sendToSerialPort(buf);
sprintf(buf,”z”); // clear screen
sendToSerialPort(buf);
sprintf(buf,”t \”%s\”\r”,”Backslash: \\\\“); // backslash in string
sendToSerialPort(buf);
sendToSerialPort(“t \”\n\”\r”); // newline
// backslash as character
sprintf(buf,”t \”%s%c%c\”\r”,”Backslash: “,’\\’,’\\’);
sendToSerialPort(buf);
sendToSerialPort(“t \”\n\”\r”); // newline
sprintf(buf,”t \”%s\”\r”,”Percent: %”); // Percent
sendToSerialPort(buf);
sendToSerialPort(“t \”\n\”\r”); // newline
sprintf(buf,”t \”Percent: %%\”\r”); // Percent
sendToSerialPort(buf);
sendToSerialPort(“t \”\n\”\r”); // newline
// Quote (need 2 to get one for SLCD, and one more to allow ” in string)
sprintf(buf,”t \”%s\”\r”,”Quote: \\\“”);
sendToSerialPort(buf);
sendToSerialPort(“t \”\n\”\r”); // newline
// Quote as character
sprintf(buf,”t \”%s%c%c\”\r”,”Quote: “,’\\’,’“‘);
sendToSerialPort(buf);
sendToSerialPort(“t \”\n\”\r”); // newline
}