Cordic trig assembly code for PIC18f


Closed Thread
Results 1 to 40 of 55

Hybrid View

  1. #1
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: Cordic trig assembly code for PIC18f

    Quote Originally Posted by B-O Eliasson View Post
    The problem is solved. I found another version of trig.inc in post 13, and it works well for me. I have to put the word variables x,y into long variables before doing any calculations on them.
    That's a good bare bones cordic version as long as you don't mind manipulating the radians. So you could either use that and do math to your liking, or you could use TrigL , which you can find with my tilt example here: http://www.picbasic.co.uk/forum/cont...-axis-g-sensor . If you use TrigL.inc, you would probably want to add a line to replace goto main with goto overcordic
    and at the end of the TrigL.inc add a line overcordic:

    Keep us posted, I'd love to see your project.

    Walter

  2. #2
    Join Date
    Oct 2008
    Posts
    51


    Did you find this post helpful? Yes | No

    Default Re: Cordic trig assembly code for PIC18f

    Hi Walter, I have been looking at this for some time now and keep coming back to this post. I am actually attempting to do a similar project to the tilt sensor project which you have built only on a single axis. I believe I am almost there now and just need a few pointers! I am looking at your code atn2. the following is the equation i require to solve: tan-1 ((zresult - calval)/SQR ((5017 - calval)^2 - (zresult - calval)^2))
    Now from reading your posts would I be right in thinking that if i do the following:

    Code:
    x=0
     y= ((zresult - calval)/SQR ((5017 - calval)^2 - (zresult - calval)^2))
    
    call atn2
    Am I right in thinking that this would convert my equation as I am not interested in the hyp or does the x vaule come into play?

Similar Threads

  1. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  2. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. 4 Chanel Dmx512 ready assembly code to PBP ?
    By syscoder in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 21st March 2007, 23:55
  5. Your Suggestions: Assembly code material?
    By dw_picbasic in forum General
    Replies: 1
    Last Post: - 2nd February 2007, 17:33

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts