View previous topic :: View next topic |
Author |
Message |
bwhiten
Joined: 26 Nov 2003 Posts: 151 Location: Grayson, GA
|
Print value in it's binary form |
Posted: Tue Mar 30, 2004 3:16 pm |
|
|
Is there a % format for printing an int16 in it's binary form? I searched the forum with no answer and I'm drawing a mental blank.
Hex would print as: 10FF
Binary would print as: 1000000011111111
Thanks. |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Tue Mar 30, 2004 3:54 pm |
|
|
I know it's a odd to hear but did you look in the manual? If it's not there it should be in the readme file. |
|
|
random_person Guest
|
|
Posted: Tue Mar 30, 2004 3:58 pm |
|
|
I'm not sure there is as I've had to ask the same question myself.
According to the CCsC.hlp file, there is no explicit binary printf type.
You could write a function to translate bits to chars and to printf one character (ascii 1 or ascii 0) per 16 times. or you could make a string of 16 chars of 1/0 and printf the string...but that would require 16+ bytes of RAM.
Of course, if there is a better way, i'd be happy to hear about it, too! |
|
|
bwhiten
Joined: 26 Nov 2003 Posts: 151 Location: Grayson, GA
|
|
Posted: Tue Mar 30, 2004 4:02 pm |
|
|
Neutone wrote: | I know it's a odd to hear but did you look in the manual? If it's not there it should be in the readme file. |
Definitely looked both places and definitely didn't find it. My memory is not as good as it used to be so I was hoping I had just forgotten the trick. I felt the forum was the next option. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
bwhiten
Joined: 26 Nov 2003 Posts: 151 Location: Grayson, GA
|
|
Posted: Tue Mar 30, 2004 5:16 pm |
|
|
PCM programmer wrote: | There is code on the forum.... |
Thanks PCM. Since it looks like it will require extra code, I'm going to rethink my application to use an existing format. |
|
|
|