I spent some hours tracking this down. As usual, it was my incomplete understanding of this setup and the error messages.
I always carefully define my variables and aliases, never relying on the IDE to just make them up for me. I also like to declare bytes and aliases for the bits I use as conditions. Sure, the compiler would probably do it for me, but I like them explicitly being in one place.
Upon a minor change to the code, it continued to compile fine, but gave me assembler errors saying that the bit aliases I was using were not declared. Of course they were declared, I do that FIRST.
The help documentation recommends this:
DimSerialByteAsByte#DefineStatusReadySerialByte.0#DefineStatusErrorSerialByte.1#DefineStatusMotorSerialByte.2#DefineStatusOkButSerialByte.3#DefineStatusUpButSerialByte.4#DefineStatusDnButSerialByte.5#DefineStatusLeButSerialByte.6#DefineStatusRiButSerialByte.7SerialByte=0// This will address the specific byte
And it works fine, of course. But if you ever fail to do that last assignment of SerialByte = 0 (or really, any value of any bit there)) it still compiles, but the assembler will throw errors on any use of any alias.
Of course it does - the compiler optimizes unused variables out of the code, and does not catch that the defines and references to the aliases amount to a "use" so there is no symbol left for the assembler to work on, One of my code tinkers removed the assignment of the byte, and there were no other assignments of bits until I tried to use them.
I had sloppily not followed another of my normal practices: always explicitly set every variable to a starting value. I bet this has caught others.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I spent some hours tracking this down. As usual, it was my incomplete understanding of this setup and the error messages.
I always carefully define my variables and aliases, never relying on the IDE to just make them up for me. I also like to declare bytes and aliases for the bits I use as conditions. Sure, the compiler would probably do it for me, but I like them explicitly being in one place.
Upon a minor change to the code, it continued to compile fine, but gave me assembler errors saying that the bit aliases I was using were not declared. Of course they were declared, I do that FIRST.
The help documentation recommends this:
And it works fine, of course. But if you ever fail to do that last assignment of SerialByte = 0 (or really, any value of any bit there)) it still compiles, but the assembler will throw errors on any use of any alias.
Of course it does - the compiler optimizes unused variables out of the code, and does not catch that the defines and references to the aliases amount to a "use" so there is no symbol left for the assembler to work on, One of my code tinkers removed the assignment of the byte, and there were no other assignments of bits until I tried to use them.
I had sloppily not followed another of my normal practices: always explicitly set every variable to a starting value. I bet this has caught others.
:-) You will enjoy the next release. When you define the variable you can initialise it.
Dim SerialByte As Byte = 0What is "One of my code tinkers removed the assignment of the byte "?
I looked for that! Thank you!