UART uint8_t transmitter function [s32k144]

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

UART uint8_t transmitter function [s32k144]

ソリューションへジャンプ
2,504件の閲覧回数
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,235件の閲覧回数
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,236件の閲覧回数
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,235件の閲覧回数
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 件の賞賛
返信