Yes, you are right... in my haste I edited it incorrectly.
I believe using a number is the worst way to do it, because it has no description behind it.
A constant is just as tight as far as compiling goes, and a variable is the way to go if you need to change which port you are reading within the loop. Both of these have the advantage that you can change all of your constants up at their definitions on the top, and you can change them easily when you move things around, like to a different PIC or pin. Also, compare these two, which do the exact same thing:
adcin 6
vs.
adcin BatteryVoltagePin
Which is easier to understand? Obviously the second. And if you use three a/d ports, with the constants all defined in a row and then you need to move things, it's one edit at the top for each... no searching and replacing multiple lines.
Bookmarks