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

Transfer data's of seven segment

Hi all..
I have to make a project where i need to transfer the data's of seven segment display to other board using 89S52.
I have one board where 4 seven segment display has been interfaced to port 0 of 89S52 (MAIN BOARD) using 10K External pull up resistor. i dont have the source code of this controller so cant make any changes to it. but what i have to do is, whatever things are been displayed on this seven segment have to display in again on other seven segment display located at approx 1 to 1.5 metres away.
so now what i have done is, i have made two new boards one is TX board and other is RX board. the controller of TX board in connected to controller of MAIN BOARD with same pin No.
Ex.
P0 of Main board to P0 on TX BOARD
P1 of Main board to P1 on TX BOARD
P2 of Main board to P2 on TX BOARD
P3 of Main board to P3 on TX BOARD

so now whatever happen in MAIN BOARD, i can keep a track on it using my TX BOARD. so again now using serial communication i need to transfer the data's from TX BOARD to RX board where again seven segment display is interfaced.
when i power the system, the MAIN BOARD displays 1234 on 7 segment for 5 seconds and then it prints EROR continuously, which i need to transfer it to RX BOARD using TX BOARD.
Code for TX BOARD:

void UART_Init(int baudrate)
{
    SCON = 0x50;  // Asynchronous mode, 8-bit data and 1-stop bit
    TMOD = 0x20;  //Timer1 in Mode2.
    TH1 = 256 - (11059200UL)/(long)(32*12*baudrate); // Load timer value for baudrate generation
    TR1 = 1;      //Turn ON the timer for Baud rate generation
}

void UART_TxChar(int ch)
{
    SBUF = ch;      // Load the data to be transmitted
    while(TI==0);   // Wait till the data is trasmitted
    TI = 0;         //Clear the Tx flag for next cycle.
}

void main()
{
UART_Init(9600);
        while(1)
        {
                UART_TxChar(P0);
        }
}


Code for RX Board

void UART_Init(int baudrate)
{
    SCON = 0x50;  // Asynchronous mode, 8-bit data and 1-stop bit
    TMOD = 0x20;  //Timer1 in Mode2.
    TH1 = 256 - (11059200UL)/(long)(32*12*baudrate); // Load timer value for baudrate generation
    TR1 = 1;      //Turn ON the timer for Baud rate generation
}

char UART_RxChar(void)
{
    while(RI==0);     // Wait till the data is received
    RI=0;             // Clear Receive Interrupt Flag for next cycle
    return(SBUF);     // return the received char
}

void main()
{
       UART_Init(9600);
        segment1=0;
        segment2=0;
        segment3=0;
        segment4=0;
        while(1)
        {
                  P0 = UART_RxChar(); // Receive a char from serial port
        }


but there is a bit problem with transfer of data's, because if the display on main board shows "1234", the RX BOARD only display "1" continuously on all 4 segment and after some time when MAIN BOARD display "EROR", the RX BOARD only display "E" all 4 segment.
i agree that switching of seven segment display is quite necessary, as i am not expecting to print 1234 at the time, but at least it should print 1 2 3 4 or EROR repeatedly, which agreed wont even be readable, as i am not doing any switching.
is there any error with my code.