>-----Original Message----- >From: Dave Dilatush [mailto:davedilatush@COMCAST.NET] >Roy wrote... > >>The left-justified output is NOT what I want to use, as has been = pointed >>out to me, full scale would be 65472 and I would need to divide to >>get a correct decimal value. It is much easier to multiply on the 18F >>with its nice hardware multiplier! > >Hmmm... keep in mind that when you are multiplying or dividing >by an exact integer power of 2 (2, 4, 8, 16, 32, etc.), you can >accomplish that with a simple left or right shift. > >For example, the instruction sequence > > rrcf Binreg > rrcf Binreg+1 > movlw 0x3F > andwf Binreg > >will divide an unsigned 16-bit number in Binreg by 4. That's all >there is to it. > >Dave D. Good Morning. I think the above code will divide a 16 bit unsigned number by 2, then mask the value with .63 Executing the rrcf pair TWICE before masking should give the result described in the text. Unless of course it's just too early on a Monday morinng, and I'm=20 missing something obvious. Lyle Happy New years to all!=20 -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body