Re: BCD List to HEX List



In <ti9zg.1555$W93.1057@dukeread05>, Philippe Martin wrote:

Marc 'BlackJack' Rintsch wrote:

And now please describe you problem a little better. ;-)

I'll try.

first of all python is not going to be used for my purpose (sigh)

I have device A which holds a binary coded decimal array [N1,N2,....Nn]
where the array represents a decimal number.

In C: unsigned char dec[] = {1,2,3,4,5,6,7,8};

I need that array converted for device B into an array where each element
represents the actual byte value.

In C: the result would be unsigned char hex[] = {0x1,0x2,0xD,0x6,0x8,0x7};

I guess any pocket calculator goes through that process for dec/hex
conversion.

Hope that's clearer.

Not really. Maybe I'm missing something obvious but I don't see the link
between your `dec` and `hex` values. 12345678 converted to hex is
bc614e. Do you need such a conversion? And should the result really be
one nibble (4 bit)/hex digit per array entry!?

Ciao,
Marc 'BlackJack' Rintsch
.



Relevant Pages

  • Re: Hex to Binary Conversion
    ... I have an array of hex bytes. ... The conversion itself depends on exactly what you mean, as well as in what order the bytes are provided. ... complement of it ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: A base conversion~ help me to correct it since it cant run
    ... An array name is a pointer to the first element of the array. ... Specify a length argument along with scanf for string input. ... To print a pointer value use the p conversion ...
    (comp.lang.c)
  • Re: compiling error
    ... the first element of an array, which will be converted to void* (a raw ... This tell fread() where in memory your object is, ... declaration, an array declaration is really a pointer declaration. ... isn't a run-time conversion, it's a compile-time re-interpretation. ...
    (comp.lang.c)
  • Re: multi dimensional arrays as one dimension array
    ... please - where does the standard say that such a conversion ... Pointer conversion yields a pointer to the same object as ... exist only where there are array declarations. ...
    (comp.lang.c)
  • Re: substring assignment in fortran, C, etc.
    ... & operator, or is a string literal used to initialize an array, an ... A pointer is not an lvalue, ... The point is WHEN the conversion is done, ... To add chaos to the ambiguity, parsing, type matching and the ...
    (comp.lang.c)

Loading