9 data bit UART

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

cross mob
Anonymous
Not applicable
        Hey, I'd like to receive using UART data with a start bit stop bit and 9 data bits, Using the mark/space option I can detect 9 data bits but I'm having troubles finding out whether the mark/space is high or low. How can I detect the mark/space bit?   
0 Likes
7 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum.

   

Do a UART_ReadRxStatus() API and check for UART_RX_STS_MRKSPC bit containing 0 or 1. See datasheet for the function.

   

 

   

Happy coding

   

Bob

0 Likes
Anonymous
Not applicable
        I tried doing that I made an if else loop that checks the mark/space bit and adds if the bit is high but the if loop always ends up in the false side. Could you please give me a code example so I could better understand how to use that function?   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Let's do it the other way: Can you please post your complete project so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
        This code should shift the data one bit to the right and make the MSB of the data received the same as the mark/space bit. When testing the MSB ends up low no matter what was the received data, and the rest of the data is being received correctly.   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The line

   

                if(RS422_in_RX_STS_MRKSPC)

   


will not work as expected. You are testing a constant, but you should test the status bits as

   

                if(RS422_ReadRxStatus() & RS422_in_RX_STS_MRKSPC)

   

 

   

Bob

0 Likes
Anonymous
Not applicable
        I believe I tried that, previously that line was if(RS422_in_RX_STS_MRKSPC & STATUS1) Slightly above that line STATUS1 receives the value of RS422_ReadRxStatus()   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Additionally: Your components are a bit old. Update components to latest (Project -> Update Components). Are you using Creator 4.0 SP1? When not, update Creator first.

   

 

   

Bob

0 Likes