How to do floating point operation in Q format(S912ZVML32)

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to do floating point operation in Q format(S912ZVML32)

ソリューションへジャンプ
1,055件の閲覧回数
maxxu
Contributor IV

Hi

   Hello everyone,I use S12ZVML32 for oil pump,How to do floating point operation in Q format,

   I use MC9S12ZVM_AMMCLIB  ,

   What functions should be used for multiplication and division of tfrac16 format?

1 解決策
890件の閲覧回数
pachamatej
NXP Employee
NXP Employee

Hi,

I'm not sure if I'm getting your point correctly, but here is what you can do:

  • Use tFrac16 type to handle your data. Please remember that at any point, the value should fit within -1.0 and 1.0 range (internally stored as Word16 -32768 to 32767).
  • Check out the library documentation - User Guide (available in the install folder) or get the library installer from Automotive Math and Motor Control Library Set | NXP 
  • Use MLIB_Mul_F16 for multiplication and MLIB_DivSat_F16 for division. You can also use another variants of these functions (see the User Guide) - please follow the examples in the User Guide.

If you are referring to the IEEE754 floating point operation, these are not supported by the AMMCLib for S12ZVM (see the User Guide, chapter 1.2). All "floating point" operations on S12ZVM are done in normalized format and represented by tFrac16 or tFrac32. More details are available in the User Guide.

Best regards,

Matej

元の投稿で解決策を見る

1 返信
891件の閲覧回数
pachamatej
NXP Employee
NXP Employee

Hi,

I'm not sure if I'm getting your point correctly, but here is what you can do:

  • Use tFrac16 type to handle your data. Please remember that at any point, the value should fit within -1.0 and 1.0 range (internally stored as Word16 -32768 to 32767).
  • Check out the library documentation - User Guide (available in the install folder) or get the library installer from Automotive Math and Motor Control Library Set | NXP 
  • Use MLIB_Mul_F16 for multiplication and MLIB_DivSat_F16 for division. You can also use another variants of these functions (see the User Guide) - please follow the examples in the User Guide.

If you are referring to the IEEE754 floating point operation, these are not supported by the AMMCLib for S12ZVM (see the User Guide, chapter 1.2). All "floating point" operations on S12ZVM are done in normalized format and represented by tFrac16 or tFrac32. More details are available in the User Guide.

Best regards,

Matej