Re: Cordic trig assembly code for PIC18f
I think I found my error in sincos. I had 36000 where 27000 now is. This did not compensate for the 90 degree shift for radians. Let me know if this works better.
Code:
sincos:
'use angle as deg.dd for example 35999 is 359.99 degrees
if ang < 9001 then ang = 9000 - ang 'change degrees to radians
if ang > 9000 then ang = 27000 - (36000 - ang) 'change degrees to radians
ang = ang * 466
ang = div32 256
asm
call sin_cos
endasm
return
http://www.scalerobotics.com
Bookmarks