Logic Machine Forum
Conversion - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Conversion (/showthread.php?tid=5925)



Conversion - CristianAgata - 12.03.2025

Hi,
I have a strange modbus that give me a number 2 byte uint (63793). I need to convert it to binary and then take the first 10 bit (from 0bit to 10 bit) and convert again into number. In this case the result number it is 305.

I explain better the conversion
63793 -> 1111 1001 0011 0001 -> 001 0011 0001 -> 305

Can you help me please.
BR Cristian Grassi


RE: Conversion - Daniel - 12.03.2025

Use modbus profile app and in there you have bit converter. Just select the bits you need.


RE: Conversion - CristianAgata - 12.03.2025

(12.03.2025, 18:06)Daniel Wrote: Use modbus profile app and in there you have bit converter. Just select the bits you need.

Ok I never saw this function, I check better.
Best regards Cristian

(12.03.2025, 18:06)Daniel Wrote: Use modbus profile app and in there you have bit converter. Just select the bits you need.

I've checked, but I've found a strange behavior... If register type it is Holding register I can insert value bitmask, instead type it os input register the app says to create the bitmask but if I download the profile this parameter there is not. Anyway this solution can work.
Best regards Cristian

p.s. I downloaded the profile edit with notepad++ and works also with type input register. (I think there is a little bug in the app)


RE: Conversion - Daniel - 13.03.2025

In did it was, re-download the app again from the forum.


RE: Conversion - CristianAgata - 13.03.2025

(13.03.2025, 11:18)Daniel Wrote: In did it was, re-download the app again from the forum.

Ok thanks so much