floating to fraction

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

floating to fraction

Jump to solution
1,539 Views
ahnjoseph
Contributor III

MCU : s12zvl

CW:  10.6

 

  I need to convert a floating point variable ram to fraction value for Using Fraction Lib

 

  float f_t1;

  tFrac16 test_frac1,test_frac2  ;

 

 

  f_t1=0.5;

  test_frac1 = FRAC16(0.5); // <--- O.K

  test_frac1 = FRAC16(f_t1) ; // Compile Err

 

 

How can i do ?

Labels (1)
0 Kudos
Reply
1 Solution
1,227 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Ahn,

I built your project from my side, I got error message:

pastedImage_0.png

this is because symbols such as __fcmp are supported in floating library only. while this project use integer library ansii.lib which doesn't support symbols.

So Fiona is correct, change ansii.lib(c_no_float support library) to ansif.lib(c_float support library) can correct the problem.

pastedImage_3.png

for HCS12z library usage of, see below:

pastedImage_2.png

my modified project is attached.

can this help you?


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

4 Replies
1,227 Views
TICS_Fiona
NXP Employee
NXP Employee

Hello Ahn

Please choose the floating Point Library instead. Please open the Project Properties from ‘Project’ menu-> Properties. Then go to C/C++ Build-> Settings, under <Tool Settings> tab, go to S12Z Linker->Input,  please replace :

"${MCUToolsBaseDir}/S12lisa_Support/s12lisac/lib_small/ansii.lib"

With:

"${MCUToolsBaseDir}/S12lisa_Support/s12lisac/lib_small/ansif.lib"

lib.png

I also attached a simple example project for using FRAC16 macro.

Best Regards

Fiona Kuang

Technical Information & Commercial Support

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

1,227 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Ahn,

what error message do you have? can you please send a screenshot of it?

to solve the problem faster, can you please send your demo project here thus i can work on your issue directly. thanks!


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
1,228 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Ahn,

I built your project from my side, I got error message:

pastedImage_0.png

this is because symbols such as __fcmp are supported in floating library only. while this project use integer library ansii.lib which doesn't support symbols.

So Fiona is correct, change ansii.lib(c_no_float support library) to ansif.lib(c_float support library) can correct the problem.

pastedImage_3.png

for HCS12z library usage of, see below:

pastedImage_2.png

my modified project is attached.

can this help you?


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,227 Views
ahnjoseph
Contributor III

Thank you Fast service

Pls check attached Proj.

Thanks your kindly service

Best Regards

……………………………………

Joseph Ahn(안연수)

Assistant Software Design Manager

Avnet Electronic Marketing.

Joseph.ahn@avnet.com<mailto:Joseph.ahn@avnet.com>

……………………………………

12th Floor, KBS Media Center, Maebongsan-ro 45 (Sangam-dong),

Mapo-gu, Seoul, 121-915, Korea

Direct:

82-2-6277-6395

Fax:

82-2-761-2133

0 Kudos
Reply