Hi 3V0,here is the code.This is just a math test.
Code:
#include<p18f4620.h>
void main(void)
{ unsigned int result;
unsigned int a=0x1018;
unsigned int b=0x0018;
unsigned int ceilingrd=0x1018;
unsigned int ceilingr=0x0018;
unsigned int diff,perc,castingl,castingh;
castingl=(ceilingrd);
castingh=(ceilingrd/256);
diff=ceilingrd-ceilingr;
result=b-a;
perc=(diff/ceilingrd)*100;
while(1);
If you see in MPLab Sim the variable perc is zero.
PS:3V0 can i PM you about a board that i made.Its basically a question(not technical) and may be useful to you.I would be really thankful.If you say yes the i will get back to you i 2 or 3 days..just wanted to ask since i have your attention.