My Math Forum

My Math Forum (http://mymathforum.com/math-forums.php)
-   Elementary Math (http://mymathforum.com/elementary-math/)
-   -   Adding two BYTEs into a WORD (http://mymathforum.com/elementary-math/343300-adding-two-bytes-into-word.html)

camerart January 28th, 2018 03:34 PM

Adding two BYTEs into a WORD
 
Hi,
By using a computer programmers calculator, how do I enter 2x BYTEs and get the answer as a WORD, please?
Camerart.

romsek January 28th, 2018 03:50 PM

can you

enter msb

shift it left 8 bits (or multiply it by 256)

OR (bitwise or)

enter lsb

ENTER

I don't know what your calculator can do.

Denis January 28th, 2018 06:45 PM

Quote:

Originally Posted by camerart (Post 587727)
Hi,
a computer programmers calculator

Whadda heck's that? No manual?

camerart January 29th, 2018 01:40 AM

1 Attachment(s)
Hi,
D, a computer programmers calculator = a calculator found on Windows computer set to programming.

R,
I tried

'Set to DEC and BYTE or BIN'

1 OR 1 then switched to WORD. =1.

FF or FF worked. Also x256.

Would you clarify 'OR' a bit more please?
C

weirddave January 29th, 2018 05:39 AM

What base are the numbers you want to enter in? if they are hex, just type the MSB followed by the MSByte with the calculator in Hex mode.
If your numbers are decimal, type the MSByte, x256 then add the LSByte, you can use any calculator for this unless you then want to convert the result to Hex after.
If this is something you need to do more than once, use Excel or google sheets, they handle Hex conversions for you too.

camerart January 29th, 2018 06:05 AM

Quote:

Originally Posted by weirddave (Post 587756)
What base are the numbers you want to enter in? if they are hex, just type the MSB followed by the MSByte with the calculator in Hex mode.
If your numbers are decimal, type the MSByte, x256 then add the LSByte, you can use any calculator for this unless you then want to convert the result to Hex after.
If this is something you need to do more than once, use Excel or google sheets, they handle Hex conversions for you too.

Hi D,
With a calculator I have on the computer (shown in previous post) set to DEC, I can't type say 220, it stops at 22. If i know the HEX, it all work.
C

camerart January 29th, 2018 06:34 AM

Hi,
I've been playing with the computer calculator, and got confused by '-'s appearing. So I don't think the calculator is for me.
In the program I'm programming, I added a little routine, that does this for me. I have to post the results online to get them verified each time, instead of the calculator.
Thanks to all.
C.

romsek January 29th, 2018 09:51 AM

Quote:

Originally Posted by camerart (Post 587745)
Hi,
D, a computer programmers calculator = a calculator found on Windows computer set to programming.

R,
I tried

'Set to DEC and BYTE or BIN'

1 OR 1 then switched to WORD. =1.

FF or FF worked. Also x256.

Would you clarify 'OR' a bit more please?
C

the Or button on your calc

camerart January 29th, 2018 11:03 AM

Quote:

Originally Posted by romsek (Post 587772)
the Or button on your calc

Hi R,
I understood that for OR I press the OR button, but no matter, I now use the program, as in my last post, thanks.
C.


All times are GMT -8. The time now is 12:16 AM.

Copyright © 2019 My Math Forum. All rights reserved.