C makro kerdes

WLC02E, wlc02e at automation.siemens.com
Thu Dec 8 11:16:47 CET 2005


Sziasztok,
 
(unsigned char) hexadecimális számot alakítanék két karakterré, mi a hiba az alábbi makróban? Lefordul gond nélkül (IAR), de hülyeséget ad vissza:
 
 
#define HEX2CHAR(hx)  ( (10>hx) ?  (hx+48):(hx+55) )
-----
 
unsigned char gsm_StringToPDU(const char* text, unsigned char txt_length, char * pdu)
 
...
 
//hivatkozás:
 
pdu[k]=(char)(HEX2CHAR ( ( (hex_temp[j]) >>4) &0x0f)  );
pdu[k+1]=(char)(HEX2CHAR ((hex_temp[j])&0x0f));
 
...
 
Köszönöm!
 
ÜdV: Zoli



More information about the Elektro mailing list