On Sat, 16 Jan 1999 18:28:34 -0800 MARK D NEWPORT writes: >I finally tried to tackle this problem myself and am having some >difficulties. It would be helpful to us to describe exactly what the problems seem to be. Looking at your code briefly, I see one minor problem and 2 major ones: A "comf PORTA,f" will do nothing to change the input value. To invert the data, I'd complement the shiftreg variable after all the bits are shifted in. But, you don't want to complement the received data. If you use an inverting line reciever, zero data bits will read as low on the pin. So the routine is OK as it is, just delete the comf. RS-232 data is transmitted LSB first. Thus you need rotate *right* into the shift register, not left. After 8 shifts, the LSB (which was received first) will be in its proper position. [A common optimization is to initialize the shift register to 10000000, then test the flag after each rotate to see if the 1 came out. When it does, 8 bits have been received. This avoids the need for a bit counter variable.] Your routine returns immediately after taking the sample at the center of the last bit. If you call it again right away (which you do) and the last bit transmitted was a zero, the routine will falsely detect the end of the last bit as a start bit, then go on to improperly receive a byte at the wrong time. If the line was idle, the byte received will be all ones. One work-around is to ensure there is a delay of at least 1/2 to 3/4 bit time (preferably 1 bit time, but not any longer) between calls to the receive routine to let the end of the last bit clear the line. A probably better approach is to be sure the line is high (inactive, a stop bit) at the top of the routine, then start looking for a start bit. ___________________________________________________________________ You don't need to buy Internet access to use free Internet e-mail. Get completely free e-mail from Juno at http://www.juno.com/getjuno.html or call Juno at (800) 654-JUNO [654-5866]