And remember that BYTEs and WORDS are unsigned so doing something like a "less than 0" will never ever return true because a BYTE or WORD will always be 0 or more in that context.
/Henrik.
And remember that BYTEs and WORDS are unsigned so doing something like a "less than 0" will never ever return true because a BYTE or WORD will always be 0 or more in that context.
/Henrik.
Ok thanks -- I'll look at it closer -- at least I know it should work with a minus 1.
I use Micro code studio by the way. Is there another IDE that is straightforward like it is but has a few more features? For example, you can't even comment out a block of code, just individual lines.
Also, I have never really had any experience with simulators. My Picbasic interest sort of peaked 20 years ago (although I still think it's fantastic) and back then simulation was a bad word.
Be nice if they came up with something that could scroll through your code and detect operational errors. ?
Here comes a dumb question --
var1 = word
var2 = byte
var1 = 2
var2 = 3
Can't you compare a word to a byte?
If var1 <= var2 then
do this
It's in my head that a word is a number with the capability of larger numbers but also higher resolution for smaller numbers?
(More decimal places?) So a 2 as a word variable is the same as a byte.
Wrong? Do I need to use var.highbyte instead ? (hobbyist -- so I forget this stuff).
You can use a word somewhat like a float, but essentially, I believe you can compare those two types.
Even if they didn’t directly compare, you could compare the byte to the lower word byte, and if the upper word byte is zero,
the first compare with he lower byte is valid. otherwise if the upper word byte is not zero, the word is higher.
In PBP all variable types stores integer values only so only the size of the number they can hold changes. The resolution is always the same.
I see no, and don't know of any, issues with comparing a BYTE to WORD or the other way around but again remember that BYTES and WORDS are always unsigned integers so a variable containing 253 will be smaller than a BYTE (or WORD) variable containin the result of 100-101.
/Henrik.
Bookmarks