how to add new line character "\n" in UART Block

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to add new line character "\n" in UART Block

4,730 Views
viet
Contributor II

Dear all, 


I would like to add ''\n" at the end of my string and print out via UART Block. I tried some method but can not, please help check my attach file. 

It would be great if hear from you soon.

 

thanks so much

0 Kudos
Reply
3 Replies

4,665 Views
viet
Contributor II

Hi @mariuslucianand @adriantudor 
great thanks for your help. Both of solutions are work for me.

thanks for your support. 

0 Kudos
Reply

4,692 Views
adriantudor
NXP Employee
NXP Employee

Hi @viet 

Another solution is to use a "matrix concatenation" block after the string to ASCII block and add decimal values for new-line and carriage return, as in this picture.

adriantudor_0-1616666503009.png

Best regards,

Adrian

4,698 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @viet ,

One way of sending the newline character is to provide the data to the LPUART send as uint8 (char) and to add in the end the number 10 (which is newline) If you also want to send carriage return is to add the number 13 also. See the below example. This is not the most elegant way, but it works.

mariuslucianand_0-1616664540478.png

 

Hope this helps,

Marius