Thanks, your version worked (of course). Here's what I see I was doing different: - You set RB1/RX low and RB2/TX high, I set them both low. Where did you get this, I didn't see this in the datasheet? - You only set RB1 as an input, I set both RB1 and RB2 (pg. 71 in the datasheet) - The order of setup was different, is this significant? - Your receive routine blocks. I was polling looking at the RCIF flag: Receive btfss PIR1, ; check if we have received and data return ; if not, just return ; otherwise, move received byte into movf RCREG, W ; result into W return - you're putting the output into TXREG, then waiting for TRMT to clear. I was waiting for TRMT to clear then loading TXREG. OK, then I'm off to find the exact error of my ways. Thanks! Kevin Tony Nixon wrote: > > Kevin Olalde wrote: > > > > Thanks for the suggestion. I was already doing that. > > > > I have a question about the suggestion though. How does the comparator adversly > > affect the USART operation? Is it the interrupts? > > > > Thanks, > > Kevin > > There should be no interraction, they are seperate periferals on > seperate ports. > > Since you are using the internal oscillator, perhaps the timing is off > by an amount that is causing the comms problems. > > Here is a small program that should echo chars back to sender at 9600. I > have used it successfully with the internal osc. > > Start movlw b'00000000' ; LVP lo, MCLR Lo > movwf PORTA > movlw b'00000100' ; RX Lo, TX Hi > movwf PORTB > bsf STATUS,RP0 > movlw b'00000000' > movwf TRISA > movlw b'00000010' ; RX = input > movwf TRISB > bcf STATUS,RP0 > ; > ; ----------------------- > ; DISABLE THE COMPARATORS > ; ----------------------- > ; > movlw b'00000111' ; disable comparators > movwf CMCON > ; > ; ------------------------------------ > ; SET BAUD RATE TO COMMUNICATE WITH PC > ; ------------------------------------ > ; Boot Baud Rate = 9600, No Parity, 1 Stop Bit > ; > bsf STATUS,RP0 > movlw d'25' ; 9600 baud > movwf SPBRG > movlw b'00100100' ; brgh = high (2) > movwf TXSTA ; enable Async Transmission, set brgh > movlw b'10010000' ; enable Async Reception > clrf STATUS ; RAM Page 0 > movwf RCSTA > > MnLoop call Receive > movwf TXREG > call TransWt > goto MnLoop > > ; > ; ------------------------------------ > ; WAIT UNTIL RS232 IS FINISHED SENDING > ; ------------------------------------ > ; > TransWt bsf STATUS,RP0 > WtHere btfss TXSTA,TRMT ; transmission is complete if hi > goto WtHere > > bcf STATUS,RP0 ; RAM Page 0 > return > ; > ; ---------------------------------------- > ; RECEIVE CHARACTER FROM RS232 OR INTERNAL > ; ---------------------------------------- > ; This routine does not return until a character is received. > > Receive nop > btfss PIR1,RCIF ; check for received data > goto Receive > > movf RCREG,W > movwf RxHold ; tempstore data > return > > -- > Best regards > > Tony > > mICros > http://www.bubblesoftonline.com > mailto:sales@bubblesoftonline.com > > -- > 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.