hex data on UART

I want to know is there a way to send hex data via UART. I tried multiple methods but they don't seem to work. 

Thanks in advance

  • Hi Harsh,

    Whenever we send or receive data, it is in the pattern of binary numbers. I guess you are talking about displaying that data in hexadecimal format.

    Have you tried data formatting in C, for example:

    int num = 30;
    printf("\nnum in decimal = %d", num);
    printf("\nnum in hexa-decimal = 0x%x", num);

    which would display the same data as below:

    num in decimal      = 30
    num in hexa-decimal = 0x1e

    Otherwise show your code snippet and elaborate your question.

    Thanks.

    Naeem

Related