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.
None of this has anything to do with Keil.
"i agree that this values wont be readable at RX board"
So how do you know that it isn't actually happening - and it's just that you can't see it?!
"first i need to check if all the four digits('1234') are being properly sent or not"
To do that, you will need something that can actually show you exactly what the 'tx' board is really sending.
ie, something which will definitely give you a readable display of exactly what it's receiving!
You can't rely upon your Rx board - because you don't know if that (also) has bugs...