> There's one more optimization that can be applied. Instead of computing > (1+(y/x)^2) and using that as input to the lg(), it'd make more sense to > compute (y/x) and create a new table that implements the function: > > f(w) = lg(1+w^2) > > This saves the squaring. > > A comment about the division: the ratio y/x will be less than 1 ( or it > should be less than 1, if it's not then factor out y instead of x). If you > performed an 8-bit integer division, you'll get zero. You could perform a > 16-bit/8-bit division and premultiply y by 0x100 (i.e. move it to the > upper byte of a 16-bit word). However a slightly more efficient division > can be found in the arctan routine: > > http://www.dattalo.com/technical/software/pic/arctan.asm > > Look for FRAC_DIV:, a "fractional division" routine. > > Also, the coefficients in the above equations can be factored into the > tables. When all's said done, this equation should take less than 200 > cycles to compute. > > Scott Thanks Scott I will look at that. I appreciate the help. I am not a complete novice with the PIC but this one is really stretching me. I can't help thinking there must be an easier way to add two non linear values! David -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body