I want to use Symbol definitions for neatness (and avoid silly mistakes if I decide to use a different pin or storage word etc). But if I want to sometimes use something like:
and other times use instructions that need "pin2" instead of "2". I cannot then use the symbolic name "Handshake". I cannot even define another symbol to be pinHandshake (as far as I can tell). Is there a way to let me define in one place which pin to use and have all the program understand? it would be nice if the compiler accepted pin2 where it accepts a plain 2 (in high/low commands, etc).
Similarly, I often have two byte variables used that must always be the high and low bytes of the same word variable, so if I decide to use different registers everything changes as it should.
So I'd like to be able to program:
If I change w2 then the byte registers used for Exponent and Mantissa should automatically change.
This would require the compiler to recognize MSB and LSB functions to return the correct byte register symbol for the given word variable name (i.e. no extra code generation), or to allow some sort of expression to decide the byte register number during parsing of the Symbol command. I may end up writing a pre-processor to do this sort of thing (but I'd prefer to find some easy way to achieve it - any ideas??).
Code:
Symbol Handshake = 2
high Handshake
Similarly, I often have two byte variables used that must always be the high and low bytes of the same word variable, so if I decide to use different registers everything changes as it should.
So I'd like to be able to program:
Code:
Symbol Voltage1 = w2
Symbol Exponent = MSB(Voltage1) ' or possibly Exponent = b{Voltage1*2+1}
Symbol Mantissa = LSB(Voltage2) ' or possibly Mantissa = b{Exponent-1} ?
This would require the compiler to recognize MSB and LSB functions to return the correct byte register symbol for the given word variable name (i.e. no extra code generation), or to allow some sort of expression to decide the byte register number during parsing of the Symbol command. I may end up writing a pre-processor to do this sort of thing (but I'd prefer to find some easy way to achieve it - any ideas??).
Last edited: