Hex word conversion

More
26 Apr 2023 11:15 #269966 by M4MazakUser
Hex word conversion was created by M4MazakUser
Sooooooo......
I have a value read from modbus into classicladder its a 16bit binary, value, or 4 character hex. Theres a high word (?) And a low word.  I need to get the high word so I can read it into pyvcp to display the spindle load.
is there an easier way than using a generic mux 16 or something else.  I've been searching for some examples 

Please Log in or Create an account to join the conversation.

More
01 May 2023 20:52 #270430 by HansU
Replied by HansU on topic Hex word conversion
You can divide the 16 bit value by 256 and you get the high byte.
Background: The same you could achieve with 8 times right shift. And one right shift is equal to a division by 2, so 8 times right shift is same like a division by 2⁸ = 256.
The following user(s) said Thank You: M4MazakUser

Please Log in or Create an account to join the conversation.

More
02 May 2023 01:51 #270442 by M4MazakUser
Replied by M4MazakUser on topic Hex word conversion
Thanks heaps for that, now its so easy !
I thought there must have been an easier way.

Please Log in or Create an account to join the conversation.

Time to create page: 0.232 seconds
Powered by Kunena Forum