These are the two equations already in the code.
NOTE: //dsdrpm [50] *16 == 800 rpm. rpm [3200] /4 == 800 rpm.
OPTION A
Code: Select all
4ddd: 11,18 clrb R18 R18 = 0;
4ddf: b3,72,e6,19 ldb R19,[R72+e6] R19 = DSDRPM;
4de3: 08,02,18 shrw R18,2 R18 = R18 / 4;
4de6: 48,18,ae,18 sb3w R18,Rae,R18 R18 = N_RPM - R18;
OPTION B
Code: Select all
505a: af,72,e6,30 ldzbw R30,[R72+e6] temp6l = (uns)DSDRPM;
505e: 09,06,30 shlw R30,6 temp6l *= 40; // 40 hex== *64 decimal
5061: 48,30,ae,30 sb3w R30,Rae,R30 temp6l = N_RPM - temp6l;
Option B is what I'm currently using.
Neither of the two options have signed variables so what would be the easiest way to make it roll over and actually be a signed equation?