• AVR Freaks

Hot!Using MCC EUSART function to work with hexadecimal commands

New Member
  • Total Posts : 16
  • Reward points : 0
  • Joined: 2018/10/02 11:14:36
  • Location: 0
  • Status: offline
2020/08/05 08:09:40 (permalink)

Using MCC EUSART function to work with hexadecimal commands

Hello all,
I am working with MCC and a PIC18F26K22.
I want to use the EUSART1 interface to send a command, which is a string in hexadecimal format.
How could I use the EUSART1_Write(uint8_t txData) function for this?
Would it work if I just directly invoke this function a couple of times, for each byte of the command, without using delays?
Could I use printf() for this?
Similarly, I get a string of hexadecimal bytes back as a response. Do I need to call EUSART1_Read() for each byte in the response I get?

1 Reply Related Threads

    Super Member
    • Total Posts : 1861
    • Reward points : 0
    • Joined: 2013/06/11 05:25:18
    • Location: South Africa
    • Status: offline
    Re: Using MCC EUSART function to work with hexadecimal commands 2020/08/05 08:22:56 (permalink)
    4 (1)
    You could use printf() for that, in MCC, select the option to redirect STDIO to USART.
    Do you want to send it as a string? You could create your own function to send a string of characters, something like this:

    void send_string(const char *x)
    while (*x)

    Then use it :

    send_string("Hello World");


    Free online Microcontroller Tutorials and Projects for Hobbyists and students. From beginners to advanced. Website: www.studentcompanion.co.za
    YouTube Tutorials: https://www.youtube.com/StudentCompanionSA
    Jump to:
    © 2020 APG vNext Commercial Version 4.5