hi guys,(adsbygoogle = window.adsbygoogle || []).push({});

Im having trouble trying to understand calculations of binary numbers. In pic16f84 i assume that a variable can have a value of 0 to 256. If i wanted to have a value larger than 256 i need to add another variable and count the number of overflow. for example when counta overflow then countb is increased.

incf counta

btfss status,z

incf countb

say if countb=2 and counta=2, then the total would be (2*256)+(2)= 514

My question is what is the assembly code in order to perform the usual maths routine of the combined result provided the end value should just be rounded to the nearest integer?

example :

(514/3) - 100 = 71.333 = 71

How does the result actually stored in the W register when you have a value more than 256?

**Physics Forums - The Fusion of Science and Community**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Math operation in assembly code

Loading...

**Physics Forums - The Fusion of Science and Community**