Show me a version of Bresenham line algorithm where there is only one addition per step. As I see it, there is at least one addition and two subtractions. We accumulate the error, that is one addition. We shift left the error one for multiply by two. We compare error with deltax which requires a subtraction at minimum. That is one subtraction. Based on the comparision, we may subtract deltax from the error and increment the y axis. That is two subtractions. Regards, James -----Original Message----- From: Olin Lathrop [mailto:olin_piclist@EMBEDINC.COM] Sent: Monday, April 02, 2001 2:29 PM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]:16bit/32bit Replacements for PIC16c7xx series. > Yes this is an expensive operation if you consider this is just one single addition operation when calculating Bresenham. I also have in the background, packets coming in from the parrallel port from a PC, which have to arrive within a reasonable time. I think it make take 100 instruction cycles or more to get a single byte from the parrallel port. I did however calculate my worst case timing senerio of 100micoseconds max, and that didn't take into account parrallel loading. If I can calculate my next position in less than that, my linear motion can achieve 10inchs per second or 600 inches per minute. This is a key factor in the whole mess of things. < The Bresenham algorithm only requires a single add operation per cycle. This sounds like a small fraction of your overall 100uS requirement. With a 16xxx PIC running at 20MHz you get 500 instruction in 100uS, which sounds like enough. With an 18xxx you get twice that many. ******************************************************************** Olin Lathrop, embedded systems consultant in Littleton Massachusetts (978) 742-9014, olin@embedinc.com, http://www.embedinc.com -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads