AnsweredAssumed Answered

How do I get there from here? Hex to Ascii from struct field

Question asked by john doe on Apr 3, 2017
Latest reply on Apr 3, 2017 by Clive One

I've been playing with the hal sd card driver today.


printf(" Product name : %lx%x\r\n", pSD_CID_Info.ProdName1, pSD_CID_Info.ProdName2);


where pSD_CID_Info is of the type HAL_SD_CardCIDTypeDef which is

typedef struct
  __IO uint8_t  ManufacturerID;  /*!< Manufacturer ID       */
  __IO uint16_t OEM_AppliID;     /*!< OEM/Application ID    */
  __IO uint32_t ProdName1;       /*!< Product Name part1    */
  __IO uint8_t  ProdName2;       /*!< Product Name part2    */
  __IO uint8_t  ProdRev;         /*!< Product Revision      */
  __IO uint32_t ProdSN;          /*!< Product Serial Number */
  __IO uint8_t  Reserved1;       /*!< Reserved1             */
  __IO uint16_t ManufactDate;    /*!< Manufacturing Date    */
  __IO uint8_t  CID_CRC;         /*!< CID CRC               */
  __IO uint8_t  Reserved2;       /*!< Always 1              */




the output is

 Product name : 5355303447


but the 0x5355303447 when converted to ascii should read

Product name : SU04G


how do I get there from here?