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.

sending and receiving multiple characters using structure

Hello,

I am using msp432p401r MCU in CCS6.1.1V

I need to send a block of data containing information unit id, location,date etc to and from UART

How to send and receive it by making use of structure.

Please let me know the related API'S.

and please send if you have any sample code 

Thanks for your time

Nafeesa Muntashar

  • There are no API, just coding. You can type-cast structure to array of bytes and send it as (8-bit) bytes over UART. Structure from other information (other structures) shall be separated using framing. One of solutions: use escape characters/sequences. You can borrow idea from HDLC protocol Asynchronous Framing: en.wikipedia.org/.../High-Level_Data_Link_Control

  • Is there only one structure? and always fixed lengths (number of chars) for all fields?
    Are you sending the complete structure back and forth or do you sometime just send one field in t he structure?
    if the later you would need some type of header with offset and lengths.

    With multiple version of the same typedef structure, you would send the address pointer of the structure to the uart subroutine etc.
    A structure can have pointers too, to point to text fields etc.
    But you would have to program this yourself.

**Attention** This is a public forum