I am writing a program for a PIC microcontroller, which I have completed using assembly, I am now trying to do the program in C. I have a module that displays text, when it encounters a ChrEsc it gets the next byte which indicates what to do, which in this case is EscVarDis so it retrieves the address word Var1 and displays the value it contains. It then continues to display any remaining text. I created the literal string in assembly like so:
DB “TEXT ”
DB ChrEsc, EscVarDis
DW Var1
DB “ MORE TEXT”
ChrEsc and EscVarDis are assembler constants and Var1 is an address.
I want to do the same thing in C, but don’t know how to embed the data. I want to be able to call a function with the address to a literal string containing the embedded data, like so:
DisplayString(“TEXT < ChrEsc, EscVarDis, Var1> MORE TEXT”)
I can’t find a way of inserting ChrEsc, EscVarDis, Var1 into the string. I know you can insert control codes using \xnn, but you can’t specify a compiler label for the value nn. I have no idea how to insert the pointer value Var1. Can anyone help with this please.