This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sbug not being set

how can the sbuf register be told to send a string that is received?

Parents
  • i tryed reading but it was not easy

    It's a technical document. It's not supposed to be light reading.
    To fully understand it, you'll probably have to read it several times, too !

    this is what i coded

    No, this is not what you coded, because it wouldn't even compile. "This" is something you re-typed in the text window. If you want to post something that you coded, you need to use copy&paste to avoid introducing more mistakes !
    And while you're at it, please read the small print above the text window. It contains detailed instructions on how to post code so that it is legible.

    main
    { SBUG="please send me a something"
    something=SBUF
    SBUF=soething+'my answer"
    }
    

    Okay. SBUF is an 8-bit register - a char. In C, you cannot simply copy a string (array of chars) to a single char by using a simple assignment. You will have to write a function that a) reads the string character by character, b) copies each character to SBUF, and c) waits until the UART is actually read to transmit the next character !

    Also, you might want to configure the UART before using it. How to do this can be found in the documents mentioned above.

Reply
  • i tryed reading but it was not easy

    It's a technical document. It's not supposed to be light reading.
    To fully understand it, you'll probably have to read it several times, too !

    this is what i coded

    No, this is not what you coded, because it wouldn't even compile. "This" is something you re-typed in the text window. If you want to post something that you coded, you need to use copy&paste to avoid introducing more mistakes !
    And while you're at it, please read the small print above the text window. It contains detailed instructions on how to post code so that it is legible.

    main
    { SBUG="please send me a something"
    something=SBUF
    SBUF=soething+'my answer"
    }
    

    Okay. SBUF is an 8-bit register - a char. In C, you cannot simply copy a string (array of chars) to a single char by using a simple assignment. You will have to write a function that a) reads the string character by character, b) copies each character to SBUF, and c) waits until the UART is actually read to transmit the next character !

    Also, you might want to configure the UART before using it. How to do this can be found in the documents mentioned above.

Children
No data