integers hi bytes & lo bytes
How do I set the values of the hi-bytes and lo-bytes for intgers?· In pbasic it is easy....
Holder.LOWBYTE = D1
Holder.HIGHBYTE = D2
the only reference to this i can find in the manual is on page 121. and im not sure what the shift laft is doing.
Holder.LOWBYTE = D1
Holder.HIGHBYTE = D2
the only reference to this i can find in the manual is on page 121. and im not sure what the shift laft is doing.
Comments
int value = (high<<8)|(low&0xFF);
To extract high and low bytes from an int use
int low = value&0xFF;
int high = value>>>8;
or define a method to make a word from bytes
int word(int low, int high) {
· return (low&0xFF)|(high<<8);
}
regards peter