One of my engineers came to me with a question that I can't answer. This is for a project using a PIC16F controller, all written in assembler.
He is defining a constant that he wants his program to use in two different ways: as an integer for use within the program and the same integer expressed as an ASCII string for use within his serial communication routines.
The standard way that I have done this in the past is to simply have the PIC convert that constant to an ASCII string at run time. However, since it is a constant, it should be possible to have the compiler do the conversion.
I've thought about it and the answer doesn't immediately come to mind.
He is defining the constant as follows:
#DEFINE gFORCE_MIN 250
He is defining the ASCII equivalent as follows:
#DEFINE gFORCE_MIN_STR "250"
The idea is that he modifies only one constant and the assembler automatically converts that constant into the double-quotes delimited ASCII value.
His last attempt returns the following after assembly:
DT "gFORCE value ","gFORCE_MIN" returns: gFORCE value gFORCE_MIN
He is currently using MPLAB 8.92.