This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to set parity bit and stop bit

i have problem how to set parity bit and stop bit in C language while sending data on serial port

Parents
  • On a C51:

    1) You always get one stop bit.

    2) To do parity set up the UART for 9 bit data.

    #include <reg51.h>
    
    void SendCharWithParity( char Data )
    {
       ACC = Data;
       TB8 = P;  //PSW.P = even parity of ACC
       //TB8 = ~P;  //odd parity
       SBUF = ACC;
    }
    

Reply
  • On a C51:

    1) You always get one stop bit.

    2) To do parity set up the UART for 9 bit data.

    #include <reg51.h>
    
    void SendCharWithParity( char Data )
    {
       ACC = Data;
       TB8 = P;  //PSW.P = even parity of ACC
       //TB8 = ~P;  //odd parity
       SBUF = ACC;
    }
    

Children
No data