On Tue, 6 Feb 2001 16:10:41 -0500 Bob Ammerman writes: > > Anyone have some quick code to divide a 24 bit number by an > 8 bit > number > > yielding a 16 bit result? > > > > Thanks! > > > > Harold > > What if the result doesn't fit in 16 bits? > It will, since I'm dividing by something like decimal 200. I'm calculating RMS voltage based on about 200 samples of voltage during a half cycle of the AC line. I was originally doing 256 and then dividing by 256 (throwing out low byte), but with clock variations I might not get 256 samples in a half cycle. So, I decided to drop down to about 200 samples and divide by the actual number of samples per half cycle. I think this is close to working, but it's not there yet. It's FUN doing this crash and burn development without an emulator! Harold FCC Rules Online at http://hallikainen.com/FccRules Lighting control for theatre and television at http://www.dovesystems.com ________________________________________________________________ GET INTERNET ACCESS FROM JUNO! Juno offers FREE or PREMIUM Internet access for less! Join Juno today! For your FREE software, visit: http://dl.www.juno.com/get/tagj. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads