MC56F8037 Endian Architecture

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

MC56F8037 Endian Architecture

ソリューションへジャンプ
1,621件の閲覧回数
jeffersonjackso
Contributor II

Hey everyone,

I am working on an application where I need to send data (floats) to another processor. I am using the MC56F8037EVM as my processor and I have been looking for how a float is stored as binary. Currently I am using a union to break my float into a char array in order to send asynchronously. I can not find the "endianness" of my processor in the data sheet or the users manual. Has anybody come across this information or have a hints as to where to look? Thanks a bunch,

Jeff

 

The union I am using. My plan is to iterate over the char array and send one byte at a time, I just want to make sure that when it is reconstructed on the receiver side all is good and well. The receiver platform is AVR.

 

union {

  float val;

  char byteVal[4];

} var;

 

ラベル(1)
タグ(2)
1 解決策
1,470件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

The IEEE single precision floating point standard representation requires a 32 bit word, which may be represented as numbered from 0 to 31, left to right. The first bit is the sign bit, S, the next eight bits are the exponent bits, 'E', and the final 23 bits are the fraction 'F':
  S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF
  0 1      8 9                    31
The value V represented by the word may be determined as follows:
If E=255 and F is nonzero, then V=NaN ("Not a number")
If E=255 and F is zero and S is 1, then V=-Infinity
If E=255 and F is zero and S is 0, then V=Infinity
If 0<E<255 then V=(-1)**S * 2 ** (E-127) * (1.F) where "1.F" is intended to represent the binary number created by prefixing F with an implicit leading 1 and a binary point.
If E=0 and F is nonzero, then V=(-1)**S * 2 ** (-126) * (0.F) These are "unnormalized" values.
If E=0 and F is zero and S is 1, then V=-0
If E=0 and F is zero and S is 0, then V=0

I think you can also find more descriptions on web by searing “IEEE 754” with Google. For example:

http://754r.ucbtest.org/standards/754xml.html

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,470件の閲覧回数
jeffersonjackso
Contributor II

Awesome! Thanks for all the help.

Cheers,

Jeff

1,470件の閲覧回数
Monica
Senior Contributor III

Hello Jefferson!

Was this insight helpful?

Keep us posted! :smileywink:

Best regards,

Monica

0 件の賞賛
返信
1,471件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

The IEEE single precision floating point standard representation requires a 32 bit word, which may be represented as numbered from 0 to 31, left to right. The first bit is the sign bit, S, the next eight bits are the exponent bits, 'E', and the final 23 bits are the fraction 'F':
  S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF
  0 1      8 9                    31
The value V represented by the word may be determined as follows:
If E=255 and F is nonzero, then V=NaN ("Not a number")
If E=255 and F is zero and S is 1, then V=-Infinity
If E=255 and F is zero and S is 0, then V=Infinity
If 0<E<255 then V=(-1)**S * 2 ** (E-127) * (1.F) where "1.F" is intended to represent the binary number created by prefixing F with an implicit leading 1 and a binary point.
If E=0 and F is nonzero, then V=(-1)**S * 2 ** (-126) * (0.F) These are "unnormalized" values.
If E=0 and F is zero and S is 1, then V=-0
If E=0 and F is zero and S is 0, then V=0

I think you can also find more descriptions on web by searing “IEEE 754” with Google. For example:

http://754r.ucbtest.org/standards/754xml.html

0 件の賞賛
返信