Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Sending More Than 255 Through UART

Status
Not open for further replies.

Suraj143

Active Member
I use EUSART in PIC 16F886.

I want to send a decimal value more than 255.Ex:Transmit 516.

How can I send more than 255 values through USART?
 
So all the time I have to count two bytes at receivers side!! Think if I reading a 16 bit string then it will be little bit hard.
 
Last edited:
Some UARTs can use 9 bits. Or use the parity bit to get 9 bits.
What is hard about two bytes? It is not as hard as using the 9th bit.
What compiler are you using?
 
I'm an assembler.

I mean without taking the 9th bit I have to send two bytes each time.Then I must make sure there must be some delay time after 2 bytes that indicates as a separator.Am I correct?

If I take 9bit for on half character & 8 bit for the other half then I don't need any delay time between words.Because 9th bit indicates the beginning of the new character.
 
Last edited:
If the values you are sending are less that 16384 then you can take advantage of the fact that ascii only uses 7 bits. Split your value into 2 * 7 bit numbers and set the top bit of the first one you send. On the receiving end you can check if the top bit is set and, if it is, then you know it is part of a 14 bit number.

Alternatively, send a control byte first (like 02 = start of block) and then the two bytes.

Mike.
 
If the values you are sending are less that 16384 then you can take advantage of the fact that ascii only uses 7 bits. Split your value into 2 * 7 bit numbers and set the top bit of the first one you send. On the receiving end you can check if the top bit is set and, if it is, then you know it is part of a 14 bit number.

Alternatively, send a control byte first (like 02 = start of block) and then the two bytes.

Mike.

Very nice.That's a nice way of doing.I like to do as you suggested.
Thanks Mike
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top