Dim var1 as word
Dim var2 as word
var1 = 1
var2 = 256 - var1
hserprint var2
The result is 511…why? This also happens on every byte boundary of var2, ie, 512, 1024, etc. Obviously an overflow, but why? Do constants larger than 255 have to be put into a properly Dim'd variable in order to do simple math?
Joe
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
#chip 18F4455, 48
Dim var1 as word
Dim var2 as word
var1 = 1
var2 = 256 - var1
hserprint var2
The result is 511…why? This also happens on every byte boundary of var2, ie, 512, 1024, etc. Obviously an overflow, but why? Do constants larger than 255 have to be put into a properly Dim'd variable in order to do simple math?
Joe