On Fri, 1 Feb 2002, Edson Brusque wrote: > Hello, > > I need to multiply a byte by another byte and then divide this result by > 255, like x = y * z / 255. > > At this moment, I'm using CCS-PICC built-in maths, but it's very > inneficient. The execution time for this calculation is about 1200 > instructions(!). > > Someone have an idea of a very fast math function in assembly to make > this? This can be done in less than 40 cycles. Is that fast enough? Hint: look at the http://www.piclist.com/ And remember that 1/255 = 1/256 + 1/256^2 + 1/256^3 ... When done, I promise this will not take anywhere near a ridiculus 1200 cycles on SDCC. OTOH, I don't think it take just 40 either... Scott -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads