>> Has anyone done >> the conversion from 4 byte real (units 1/256 seconds) to degrees, minutes >> and seconds in a PIC >> in assembler? >> It would look something like ((B1*256^3)+(B2*256^2)+(B3*256)+B4)/3600)/256. >> Would a simple >> 16F84 be able to do that? >> >> Henk VK2GWK (PA0ADC) > >On that math, no problem on an 'F84; what you're talking about is >simply generating a 32-bit number from the 4 bytes B1, B2, B3, B4, then >dividing it by 3600 and by 256. You can start off by doing the divide >by 256 (just shift the decimal place - B4 is now to the right of the >decimal place) - then divide by 3600. Scott Dattalo or someone probably >has a better way here, of course. Yeah. Peace of cake.. :) 1. Convert to degrees deg = B1B2B3B4 / (3600 * 256) You will need 32 by 24 fixed point divide routine from Application Note 617. 2. Convert residue to minutes min = res / (60 * 256) Same routine may be used, though 24 by 16 is enough. 5. Convert residue to seconds and "subseconds" sec = res / 256 - higher byte of residue ssec = res - sec * 256 - lowest byte of residue