I guess I should see which way uses least code space too, but I just tryed to complile the first suggestion and it did that OK. I'll only know if the code runs as expected later today, when I burn a PIC and try it.
I added this to my code.
Code:lAC2 var Long 'Long variables for calibration values actually negative in my sensor lAC3 var Long lMB var Long lMC var Long 'Convert unsigned PBP Word var to signed PBP Long var. lAC2 = AC2 'copy word to long if AC2.15 then lAC2.HIGHWORD = $FFFF 'Check for negative, set top 16bits to all 1's if true lAC3 = AC3 'copy word to long if AC3.15 then lAC3.HIGHWORD = $FFFF 'Check for negative, set top 16bits to all 1's if true lMB = MB 'copy word to long if MB.15 then lMB.HIGHWORD = $FFFF 'Check for negative, set top 16bits to all 1's if true lMC = MC 'copy word to long if MC.15 then lMC.HIGHWORD = $FFFF 'Check for negative, set top 16bits to all 1's if true




Bookmarks