This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to include sin cos LUT in the code? (28335 dsp)

Other Parts Discussed in Thread: CONTROLSUITE

Hi,

I have included math.h in my code. The problem that i face is that whenever I include sin() or cos(), frequency of sensed variables goes wrong.

I dont know what is happening exactly. I am thinking of putting a LUT for sin ,cos. Can someone explain me how to do it. I dont want to use iqmath.

I am seeing waveforms on ccs v3.3 graph.

Thanks a lot

  • Shyam,

    There is already a sine look-up table in the boot ROM of this device.  This may be what you're looking for.  Take a look at the boot ROM documentation: spru963a.  That will tell you how to download the ROM source and tables.

    If the problem is the sin() and cos() functions are taking too long to execute, you may want to look at the fastRTS library, which contains more cycle efficient forms of these functions.  The library is in controlSUITE, and you can also download it at:  http://www-s.ti.com/sc/techlit/sprc664.zip

    Regards,

    Richard

  • But why should it take more time in looking up from boot ROM.
    Thanks
  • Shyam,

    I'm not saying that.  You were having problems when you used the sin() & cos() functions, possibly because of the execution time.  

    These functions are standard C routines in the run-time support library, however there is are faster routines available in the "fastRTS" library I mentioned.  Alternatively, you could choose to use the ROM look-up tables directly in your code.  It boils down to how fast you need the code to run and how much accuracy you need in the answer. 

    Regards,

    Richard

  • Thank you for immediate response.
    My code is actually not very time critical. I am sensing some signals, processing them and generating a PWM and feeding to an inverter.
    I doubt whether it is the execution time or something else (related to sin ,cos) that is creating the problem.
    Anyways , I will try the fastrts library.

    Thanks a lot