Because of the holidays, TI E2E™ design support forum responses will be delayed from Dec. 25 through Jan. 2. Thank you for your patience.

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ASCII interpretation over UART communication

Hello everyone, I had a doubt, Using UART in my msp432 i transfer from 0 to 255, in my computer I am using MATLAB to receive the information, I save the data in a vector, but when I open it I got that from 0 to 32 the vector is in blank, and from 128 to 255 the symbols are not recognized.

I assume that MATLAB does not recognize high ASCII, but anyone knows a method to read the serial data in hexadecimal and not in his ASCII interpretation???? maybe in another programming language.

  • Ho Josue!

    There is absolutely no difference if a value is decimal, hex, binary or whatever - these are just different ways for the same thing. For example 82d is equal to 52h which is equal to 122o (octal) which is also equal to 01010010b or 'R' in ASCII. It depends on how you interpret the data.

    So it looks like your MATLAB simply does not support the extended ASCII table - the standard ASCII table only uses 7bits, so from 0...127 as in your case. Extended ASCII uses all 8 bits. This means that your question is MATLAB related - maybe you want to ask this question in a MATLAB forum. Or you are lucky and someone here can answer how to use the full ASCII set in MATLAB or how to change the represantation of the data to decimal, for example. I don't know, sorry.

    The ASCII characters from 0 to 31 are control characters, so this might be the reason why there is nothing shown as well, but only in ASCII represantation. If you find out how to switch over to decimal or hex, you will see that there are values.

    Dennis

  • In short - don't ever try to send _data_ as ASCII codes 0..255 to computer. It is ok to communicate such way between closed (embedded) systems, but not for PC (software).

    Better send numeric ASCII strings using just ASCII symbols 48 to 57, delimited with newline, like this:

    1234
    2345
    3456
    4567
  • Hi Dennis, i solved it, you just need to use the correct command on matlab, it was (fread) instead of (fscanf), the last one give the ASCII interpretation and "fread" return the binary value.

**Attention** This is a public forum