Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
sub main()
Dim resp(1 to 5) as Byte
resp(1) = 0
resp(2) = 0
resp(3) = 0
Dim MSB as UnsignedInteger = Shl(CUInt(resp(2)), 8)
Dim b as Byte = resp(3)
Dim LSB as UnsignedInteger = CUInt(b AND 0HFF )
end sub
ndudman wrote:what am I doing wrong with the Bitwise AND ?
The error is with the second operand to the And, an improperly formed hexadecimal constant. It will compile without error if you change it as shown below.
Dim LSB as UnsignedInteger = CUInt(b AND &HFF)
The internal error occurs because the improperly formed initializer isn't being handled correctly. We will need to research this further to find out how to correct it.