Hello:   I am writing a program (for the MPC555 / 32-bit...

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

Hello:   I am writing a program (for the MPC555 / 32-bit...

1,881件の閲覧回数
me
Contributor I

Hello:

 

I am writing a program (for the MPC555 / 32-bit uP) that stores binary data (with radix point) in an array and performs math operations on this data.  The result is stored in the array. 

 

Is there a way to initialize the array so that it accepts, stores and displays data only in the binary format?  The issue is that the array displays the result in the Decimal format.

 

For example, I would like the following operands entered to the array to yield the result shown:

 

      11  operand1 (binary)

   + 01  operand2 (binary)

    100  result (binary)

 

However, the result appears as '12'.

 

Your suggestions would be most appreciated.

 

Regards,

CodeMan

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 返信

816件の閲覧回数
CrasyCat
Specialist III
Hello
 
Not sure I understand what you are trying to do here.
Are you programming in ANSI C and are you looking for a way to encode binary constants in ANSI C?
 
ANSI C standard does not define any notation for binary constants.
Only thing you can use is hexadecimal constants (0x.....). Converting binary value to Hexadecimal is quite easy :smileyhappy:.
 
I hope this helps.
 
CrasyCat
0 件の賞賛
返信