I'm a real PbPro Maths dunce and am asking for members advice on converting the following maths
routines into code.
Baiscally i have a byte array of hex data BD[11] recieved via a serial interface. I'm happy with this and the data recd.
Now taking bytes from array BD [4] and BD [5] as an example i need to perform the following calcu
lation on the bytes.
I appreciate the decimal point will cause an issue. Any examples of code that would perform this.(Multiply 1st number by 128, add result to 2nd number, take off 2048, divide the result by 20.48)
I came up with
But this losses the accuracy of the end part of the formula?Code:Result = (((BD[4] * 128) + BD[5]) - 2048) / 20
Also for a second formula involving BD [2] & BD [3] I need to
I'm stuck on extracting a value for the right hand digit of the hex number?(Multiply the right hand digit of 1st hex number by 128, add result to 2nd number)




Bookmarks