It would easier to run the 89C51 off 16MHz instead of 24MHz and configure the serial port to MODE 2 with the PCON register to &h00. This ensures that the serial port runs at exactly 250Khz since the baud rate in Mode 2 is 1/64 of the 16Mhz if PCON is set to &h00. Thus 16000000/64 = 250000 Hz. Now unless you do a MOV SBUF thingy, the serial port does not start transmission. So you are free to to what you like with the P3.1 (TXD) pin. Configure a timer/counter to do your time measuring remembering that a counter is internally clocked at 1/12 of the crystal frequency. Set the TXd pin LO and start the counter. When the counter counts about 120 micro secs ( which is safer then the 88 microsecs your BREAK is over...Set the TXD pin HI and reset the counter. No count to about 18 micro secs(safer than 8 micro secs) When completed, your MAB is done. Now transmit your 1st byte (SC..&h00) using the MOV SBUF remembering TO SET SCON.3 TO "1" BEFOR YOU DO SO. This transmits the 9th bit as high....2 stop bits,remember !! The rest of the data is now transmitted in a similar manner. Good luck Ujjal Kar ;-----------------------------------CONFIGURE SERIAL PORT MODE 2 WITH 9TH BIT=HI VALID, 10100000
;-----------------------------------CONFIGURE BAUDRATE = 250KHZ WITH 16MHZ XTAL
MOV $PCON,#0000
MOV $SCON,#0080
Message Thread
« Back to index