Jump to content
43oh

MSP430G Series Got the QMathLib and IQMathLib from TI


Recommended Posts

I've been waiting for quite some time for some decent fixed-point library support from TI for the G Series and looks like we finally got it. The link to the libs is at the link below:

 

http://www.ti.com/tool/msp430-iqmathlib?DCMP=ep-mcu-msp-iqmath-en&HQS=ep-mcu-msp-iqmath-em-tf-en&sp_rid_pod4=MTcwNDA5NzM3MzUS1&sp_mid_pod4=45625358&spMailingID=45625358&spUserID=MTcwNDA5NzM3MzUS1&spJobID=421682205&spReportId=NDIxNjgyMjA1S0

 

They even give benchmarks for the performance of an MSP430G2553 when using the various functions in the libraries.

Link to post
Share on other sites
  • 3 weeks later...

Guys,

 

Please help !!! This Qmath library is Aweful !! why is nothing working?

 

I mean, they have a crazy example Signal_FFT but how is this supposed to help me understand the basic functions? Why don't they have a quick example to show how each function is working?

 

I am trying to just do a division: (how can this be so damn hard to do a DIVISION!) ( Don't get me wrong, I am really glad  they come up with this Qmath library, Thank TI, But please make it easier to understand)

 

Here is the code I tried:

#include "msp430.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#include <QmathLib.h>

int main(void)
{
	_q12 f1 = _Q12(7.0);
	_q12 f2 = _Q12(1.0);
	_q12 f3 = _Q12div(f2, f1);

	return 0;
}

I have a breakpoint just before "return 0;". When I run this f1 turn to be 0 and f2 turn to be 585. So 1/7=0.142857 and 1/7*2^12=585.14.

 

So f3 should be 585, not f2. And why f1 =0?

 

I also tried their code:

#include "msp430.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#include <QmathLib.h>

int main(void)
{
	_q12 X, Y, Z;
	X = _Q12(1.0);
	Y = _Q12(7.0);
	Z = _Q12div(X ,Y);

	return 0;
}

CCS tell me there are errors in this code and don't even want to load the code in the msp430.

 

If someone has been able to make the Qmath library work, I would really appreciate some help as i spent 2 hours just trying to figure out how to do a division and it is still not working.

 

Thanks in advance for you help.

Link to post
Share on other sites

Alright,

 

This works better:

#include "msp430.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#include <QmathLib.h>

_q12 _Q12div(_q12 A,_q12 ;
_q12 X = _Q12(1.0);
_q12 Y = _Q12(7.0);
_q12 alpha;

int main(void)
{
	alpha = _Q12div(X ,Y);

	return alpha;
}

That would be nice to have a small code like this for other functions though. Please post if you have been using other ones.

 

Thanks

Link to post
Share on other sites

Did you follow how to add the library to a project in CCS? It's listed in the documentation. I attached a snippet of the IQMath doc that can be found below.

 

Also, I noticed that the CCS debugger also did strange things for me with the example program, too. The values shown in the debugger appear incorrect but the program works just fine. Kinda weird. I'll have to check it out more in-depth.

post-33599-0-25208300-1399255268_thumb.png

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...