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.

How to receive data in UART?

Other Parts Discussed in Thread: HALCOGEN

Hi,,

I need receive the data through SCI and to enable the timer inside the IF LOOP if the received data is equal to 5. How it can be done. i have written some codes and it is not working please support to proceed further

5722.UART3.rar

Regards

K.Manjunathan

  • Hi Manjunathan,

    Looking at your code briefly - the initial 'sciInit()' looks ok assuming you configured the sci correctly in HalCoGen.

    But to me it looks like only 1 character is received over the UART. If this character is 5 then you do something with the het.
    If not then you wait forever at the final while(1) loop. [meaning that if any more characters are received you ignore them].

    Normally I'd expect there to be a loop around sciReceive and the if(d=5) so that if the first character isn't a '5' you allow the code to try again
    until a '5' is received.

    Also - side note - I would probably move hetInit(); to the beginning of the code with sciInit().
    Otherwise it will take quite some time to actually start the PWM in response to the '5' because first you have to do the whole het initialization.

    Best Regards,
    Anthony
  • Thank you Mr.Anthony Seely

    I will do as you directed and i will come back if i have any struggle.

    Thanks and regards
    K.Manjunathan
    PSG IAS