Hi,
I am in the process of implementing a reference sine wave and a triangular carrier wave on a TMS320 in order to generate a 50Hz sine wave output...just wondering if anyone has any reccomendations on the best method of doing this?
Cheers,
Seán
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.
Hi,
I am in the process of implementing a reference sine wave and a triangular carrier wave on a TMS320 in order to generate a 50Hz sine wave output...just wondering if anyone has any reccomendations on the best method of doing this?
Cheers,
Seán
Hi Sean,
Maybe generating a table with some values (take in count the number of points you are gonna take), you can use some timer to generate the triangular wave. You can search this forum to look futher information.
Regards
Gastón
Thank you Gastón.
I was thinking of doing this, storing in an array of 250 points. I was thinking this would be a better way than calculating the sine value on the fly and comparing to the timer for the triangular wave.
Cheers,
Seán
Hi Sean,
Thats what I say with "make a table", if you want to use 250 points of the sine wave, you have to do some calculus first to be able to store the correct values. (Take in count the number of bytes you are gonna use---->8 bits, 16 bits, 32 bits).
Regards
Gastón
http://focus.ti.com/docs/toolsw/folders/print/sprc083.html
there is also the IQMath sine wave tables in the boot ROM.
Thanks Chris - that is very helpful. As for the IQMath sine wave tables - is this a more efficient way of generating the sine wave than that in the signal generator software?
When using the IQsin function from IQMath I dont seem to get the correct sine value...
For example: I have set a variable
X = _IQsin(_IQ(0.1244)); however when I check the value of X it is 1.352356, compared to 0.12406 in Excel.
Please can someone explain what is happening?
what are your Q values? How are you converting from X to a decimal to compare to excel? Are you using the watch window conversion in CCS?
My Q is 15 (set at GLOBAL_Q) and yes I am using the watch window conversion in CCS...it works for the other IQMath functions except the trigonometric ones.
did you break this up?
verify _IQsin of a known value (90 rad in IQ15) and the IQ conversion of the decimal value?
Yes - I used the example from the IQMath document for _IQ29.
So I did the following:
_iq29 in;
_iq29 out;
in = _IQ29(0.25*3.14156);
out = _IQ29sin(in);
I am expecting out to be 0.707 - however I am getting 0.61 in the watch window... I am very confused; am I missing something?
Ok....I have tried a range of Q values, but have yet to get a correct sine value.
for example the sine of 90 radians should be equal to 0.893996664; however in spite of whatever Q value I use I never ever get this value.
What am I doing wrong? I have created a new workspace with a clean project from scratch, following the IQMath installation instructions and it still does not work.
If anyone has any suggestions, or a verified working sample project can you please send it on so that I can try it - perhaps it is the IQMath.lib file I am using, or the IQMath.h file or most likely the *.cmd file...
Thank you for your time in advance,
Seán
make sure in the watch window that you set out as 32-bit long and q29.
It has to be an issue of how the data is being viewed.
I have checked both..
In the watch window I have the variable declared as
- _IQ29(Variable Name) and it displays -1.94 for sine(90) and
- Variable Name with the IQ value set to 29 and it displays -1.94 for sine(90)
I have also confirmed in the out.map file that the IQMath sine instruction is executing from BOOT ROM..
Any other ideas?
SeAn,
have you had any more luck with your issue?
Note that the IQsin functions takes radians as an input. In you example above, did you want sine(90degress) or sine(90radians)?
Also, the value "90" does not fit intoa Q29 number (overflows). Thta is why you are getting wrong results.
If you change the Q value to say Q25, then you should get correct result (assuming you meant 90 radians).
Cheers,
Alex T.
Hi Alex T.
Thank you for your reply - but I have yet to solve this issue.
I am solving for 90 radians.
I have previously tried all of the IQ values from 30 down to 15 and did not get the correct answer for any of the values in the watch window. It should be relatively straight forward so i am perplexed as to what is happening.
Cheers,
Seán
Sean,
what exact device are you using?
Whcih IQmath library version?
Which version of CCS?
Whcih version of codegen tools?
Cheers,
Alex T.
Hi Alex,
See inline...
what exact device are you using?
TMS28035.
Whcih IQmath library version?
1.5c is the version of the IQmath header file.
Which version of CCS?
3.3.83.19
Whcih version of codegen tools?
v5.2.1
Thanks,
Seán
SeAn,
There is a fixed-poing library called software test bench library available for download at
http://focus.ti.com/docs/toolsw/folders/print/sprc084.html
This lib is very old and document is a little bit messy but it still can be used as a reference. We are gonna release a new
version of this stb.lib under controlSUITE soon. Hope this information would be helpful to you.
-Yu Cai
Sean,
I tried on my hardware with similar versions as your set up and had no problems with the IQXsin function.
Can you create a simple project, zip it, and email it to me at: a-tessarolo@ti.com
Cheers,
Alex T.