Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

# 16 bit transfer in 8 bit uart

Level 4
Level 4

Hi,

I could separate 16 bit data into two 8 bits,but i couldn't figure out how to transmit,receive and combine them back.

-Newbie to PSoc3

1 Solution

# Re: 16 bit transfer in 8 bit uart

Level 8
Level 8
uint16_t myint16=((uint16_t)firstbyte)<<8 + secondbyte;
10 Replies

# Re: 16 bit transfer in 8 bit uart

Anonymous
Not applicable

Hi,

If you have split the data array as bytes then all you need to do is PutChar() and GetChar() to send and receive respectively.

# Re: 16 bit transfer in 8 bit uart

Level 4
Level 4

Tried it..could u please elaborate?

# Re: 16 bit transfer in 8 bit uart

Level 8
Level 8
uint16_t myint16=((uint16_t)firstbyte)<<8 + secondbyte;

# Re: 16 bit transfer in 8 bit uart

Level 4
Level 4

ive got that..but how to write a logic for transmission and reception?..how will the uart differentiate the first and second bytes?

thanks in advance

# Re: 16 bit transfer in 8 bit uart

Level 8
Level 8

When you configure the UART to send 8 bits, then handling high and low byte is up to your program. You just need to define which one to send first. Then the receiving end takes them in this order and combines them together.

# Re: 16 bit transfer in 8 bit uart

Level 4
Level 4

Thanks a lot!!...It Worked

# Re: 16 bit transfer in 8 bit uart

Level 4
Level 4

Hello Aditya,

Can you please share the code for 16 bit data transfer in 8 Bit UART as an example. I need the same for my project and want to try this possibility for my case.

# Re: 16 bit transfer in 8 bit uart

Level 4
Level 4

Hello dhans..sorry for the delay..please give me your mail id so that i can share the code.

Attachments are accessible only for community members.

# Re: 16 bit transfer in 8 bit uart

Level 4
Level 4

Thanks Aditya!!  I have been offline for long, so could not check the status. I could not move though in my project, I have attached my case for reference and suggestions ..

# Re: 16 bit transfer in 8 bit uart

Level 4
Level 4

It got solved Aditya. Thanks !!