Thank you skymath
I will give it a try this evening
I have PBP 2.50 need to patch to 2.50b, what is special in 2.50 regarding to
my conversion problem, dont find anything in the changes log that points to that



Quote Originally Posted by skimask View Post
This might get you 2 behind the point...
Code:
scale = 1024
dummy = position << 6'wont overflow 16 bits, same as *64 but quicker
dummy = dummy * 360 'will overflow 16 bits
result_high = div32 scale 'but doesnt matter here
degrees_whole = result_high >> 6 'same as divide by 64 but quicker

scale = 1024
dummy = position << 6 'wont overflow 16 bits, same as *64 but quicker
dummy = dummy * 36000 'will overflow 16 bits
result_low = div32 scale 'again, doesnt matter here
degrees_fraction = result_low >> 6 'same as divide by 64 but quicker
degrees_fraction = degrees_fraction // 100 'take out the -whole- degrees and leave the fraction

lcdout $fe , 1 , "Degrees:" , DEC3 degrees_whole , ":" , DEC2 degrees_fraction
This should work for a 10 bit ADC, but for a 12 bit ADC, the 2nd chunk will overflow. Changing the 36000 to 3600 and 100 to 10 should let the 2nd chunk work with one digit behind the decimal point, or change 36000 to 9000 and 100 to 25 and you'll get 2 digits behind the decimal point but in steps of .04

And upgrade to PBP 2.50b