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

cancel
Showing results for 
Search instead for 
Did you mean: 

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

154 Views
viet
Contributor I

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
3 Replies

89 Views
viet
Contributor I

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

thanks for your support. 

0 Kudos

116 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

122 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