UART uint8_t transmitter function [s32k144]

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

UART uint8_t transmitter function [s32k144]

跳至解决方案
2,492 次查看
electronica2pow
Contributor III

Hi to the community,

I am trying to send an uint8_t number using this function:

void LPUART1_transmit_int(uint8_t number){
while((LPUART1->STAT & LPUART_STAT_TDRE_MASK)>>LPUART_STAT_TDRE_SHIFT==0);
/* Wait for transmit buffer to be empty */
LPUART1->DATA=number; /* Send data */

}

But it doesn't work. I am going to attach the code below.

The original one is: 

void LPUART1_transmit_char(char send) { /* Function to Transmit single Char */
while((LPUART1->STAT & LPUART_STAT_TDRE_MASK)>>LPUART_STAT_TDRE_SHIFT==0);
/* Wait for transmit buffer to be empty */
LPUART1->DATA=send; /* Send data */
}

标记 (3)
0 项奖励
回复
1 解答
2,223 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,
If the program receives ‘1‘ in ascii which is 49, it will return ‘>‘ (62) and uint8_t = 12.

It seems it works.

pastedImage_1.png

Regards,
Daniel

在原帖中查看解决方案

2 回复数
2,224 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,
If the program receives ‘1‘ in ascii which is 49, it will return ‘>‘ (62) and uint8_t = 12.

It seems it works.

pastedImage_1.png

Regards,
Daniel

2,223 次查看
electronica2pow
Contributor III

  I was using Putty and it doesn't simulate it correctly, so i know that i wasn't using the right program, as always, Thanks Daniel!

0 项奖励
回复