How to get LSB from 16bit unsigned value?
Jürgen Jürgenson 2 years ago in Devices / Modbus • updated 2 years ago • 3
I'm wondering if there is a better way - Komfovent AHU sends its time and date values in 8x2int where MSB is hour value and LSB is the minute value.
I couldnt get the correct values with the options bOS has, so i turned to math... but i feel like the programs i made may be incorrect.
First i divided the 16bit unsigned value with 256 to get the MSB first. Then i basically subtracted the MSB value i got from the MSB Int value and multiply that again with 256.
As i need to make a visu for the scheduler then it feels like a lot of trouble separating the values. Any better solutions?
Customer support service by UserEcho
I got it working. I needed to make separate integer values for the users visualization, where they can input the time(hour and minute). As the calculation value itself is read only.
Maybe i will release its template when im done with it.
I used BitConverter.
Same approach for Month-Day. I have not tried it for scheduling but I believe it should work too.
Thanks for the tip! This seems to be a much better solution - I didn't even know this option existed.