I would like to suggest you to narrow down the range to locate the bug. You may bypass all communication-unrelated codes and focus on the serial port operation. Just to verify the TX/RX is correct. One thing can try is keeping sending an identical printable char to the receiver and let the receiver display it as directly and quickly as possible. I still suspect the receiving port is unintentionally accessed if the waveform to the receive pin is correct. Raymond -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Jennifer Loiacono Sent: January 24, 2002 10:32 AM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: PIC18 USART RX Data Corruption The value is transmitted (also via USART - possibly a clue?) to a serial LCD. The code is listed below. All references to AARGBx, BARGBx, and FXDxxxxxx registers/routines are part of the standard math libraries provided by Microchip. I have used them extensively, and they never SEEM to cause any other problems. ;generic display routine SERDISP BTFSS TXSTA,TRMT ;if transmit shift register full GOTO SERDISP ;loop until ready BSF TXSTA,TXEN ;enable transmission MOVFF CHARIN,TXREG ;move new character into buffer RETURN ;display input value LIMDISP ;position cursor MOVLW 0xFE ;instruction character MOVWF CHARIN CALL SERDISP MOVLW 0x80 ;position 1,0 MOVWF CHARIN CALL SERDISP MOVLW 0x4C ;L MOVWF CHARIN CALL SERDISP MOVLW 0x49 ;I MOVWF CHARIN CALL SERDISP MOVLW 0x4D ;M MOVWF CHARIN CALL SERDISP MOVLW 0x3A ;: MOVWF CHARIN CALL SERDISP ;divide by powers of 10 to get one decimal character at a time MOVFF RCREG,AARGB0 ;move limit into dividend register MOVLW 0x64 ;100d MOVWF BARGB0 ;move to divisor register CALL FXD0808U ;unsigned 8x8 division MOVLW 0x16 ;load high byte of PC for table lookup vector MOVWF PCLATH ;program counter latch high MOVF AARGB0,W ;move quotient to wreg for code lookup CALL ASC_TBL ;lookup hex code for ascii character MOVWF CHARIN ;move value to character holding register CALL SERDISP ;display character MOVFF REMB0,AARGB0 ;move remainder to use as next divisor MOVLW 0x0A ;10d MOVWF BARGB0 ;move to divisor register CALL FXD0808U ;unsigned 8x8 division MOVLW 0x16 ;load high byte of PC for table lookup vector MOVWF PCLATH ;program counter latch high MOVF AARGB0,W ;move quotient to wreg for code lookup CALL ASC_TBL ;lookup hex code for ascii character MOVWF CHARIN ;move value to character holding register CALL SERDISP ;display character MOVLW 0x16 ;load high byte of PC for table lookup vector MOVWF PCLATH ;program counter latch high MOVF REMB0,W ;move remainder to wreg for code lookup CALL ASC_TBL ;lookup hex code for ascii character MOVWF CHARIN ;move value to character holding register CALL SERDISP ;display character MOVLW 0x20 ;space MOVWF CHARIN CALL SERDISP RETURN ----- In Response To ----- Jen, How do you 'print' out the data received? By outputing them to LEDs? Transmitting the received data again to a PC? I am trying to see if it's possibly the code. Rudy > The transmission is from PIC to PIC - one USART to another. The sending PIC > is a 16F627. The scope readings show perfect 5V signals at 9600 baud. > There is no parity bit, only 8 data bits, plus start and stop bit. > > Jen > > > > Despite accurate signal levels, debugging RCREG immediately > > after data is > > > received reveals that the byte seems to flip back and forth. > > > > > > e.g., a byte equal to 4 (dec) will oscillate between 4 and > > 32. A byte > > equal > > > to 1 will oscillate between 1 and 128, etc. > > > > > > Again, this value is being read immediately after reception > > (triggered by > > RX > > > interrupt), so it is highly unlikely that program code > > could be altering > > the > > > register after reception. > > > > > > Has anyone seen a problem like this before, or perhaps have > > any ideas as > > to > > > its cause? I have been stumped on this for a while, so ANY > > help would be > > > greatly appreciated! > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.