Tony, I'm curious about your TRISC setup. In all the data books I've seen relating to 16C/Fx devices with built-in USARTs, both Bits RC7 and RC6 are suppose to be set as inputs for use in the Asynchronous mode. I've been doing it this way for years without problems. Apparently they don't from your example so this must be one of those `eternal flaws' that propagate thoughout their docs like their ISR examples... Have you always been doing it this way? Another issue is not checking for Overrun errors via OERR. If you get one, you have to clear the Continuous Receive Enable Bit (CREN) and then set it. If not, the USART will stop receiving. Finally, there is the Framing Error (FERR). If you get one of those, you should flush the Rx register (RCREG) by reading it. The following is a simple `snippet' from one of my ISR routines in CVASM (Parallax) and MPASM syntax: CVASM: :INT1 JNB OERR,:INT11 ; If Overrun Error CLRB CREN ; Clear Overrun Error SETB CREN :INT11 JNB FERR,:INT12 ; If Framing Error MOV W,RCREG ; Clear RCREG JMP :INTX ; Exit :INT12 MOV rxbyte,RCREG ; Get Byte from USART MPASM: INT1 BTFSS RCSTA,OERR ; If Overrun Error GOTO INT11 BCF RCSTA,CREN ; Clear Overrun Error BSF RCSTA,CREN INT11 BTFSS RCSTA,FERR ; If Framing Error GOTO INT12 MOVF RCREG,W ; Clear RCREG GOTO INTX ; Exit INT12 MOVF RCREG,W ; Get Byte from USART MOVWF rxbyte Depending on the application, you would probably want to also set a user-defined error flag. - Tom At 12:21 PM 2/15/00 +1100, Tony Nixon wrote: >Here is some simple RS232 code. > >Make sure TRISC settings are RX pin = input (RC7), Tx pin = output >(RC6). > > bsf Status,rp0 ; ram page 1 > movlw b'10xxxxxx' ; x = your data > movwf TrisC >; >; BAUD RATE SETTINGS >; > movlw d'51' ; 1200 baud > movwf spbrg > movlw b'00100000' ; brgh = low > movwf txsta ; enable Async Transmission > bcf Status,rp0 ; ram page 0 > movlw b'10010000' > movwf rcsta ; enable Async Reception > movf rcreg,w > movf rcreg,w > movf rcreg,w ; flush receive buffer >; >; >; ------------------------------------ >; PROVIDE A SETTLING TIME FOR START UP >; ------------------------------------ >; > clrf Temp >settle decfsz Temp > goto settle > >; >; ---------------------- >; WAITING FOR PC COMMAND >; ---------------------- >; >WaitCom call Receive ; wait and read from RS232 > > movlw 'A' ; command A > xorwf RxHold,w > btfsc Status,z > goto ComndA > > movlw 'B' ; command B > xorwf RxHold,w > btfsc Status,z > goto ComndB > > movlw 'E' ; received character error > movwf txreg > goto WaitCom ; char error if code gets to here > >ComndA movlw 'A' ; return A char > movwf txreg > goto WaitCom > > >ComndB movlw 'B' ; return B char > movwf txreg > goto WaitCom >; >; ---------------------------- >; RECEIVE CHARACTER FROM RS232 >; ---------------------------- >; This routine does not return until a character is received. > >Receive nop > btfss pir1,rcif ; (5) check for received data > goto Receive > > movf rcreg,w > movwf RxHold ; tempstore Rx data > return ; Rx data in W also > > >-- >Best regards > >Tony > >http://www.picnpoke.com >mailto:sales@picnpoke.com ------------------------------------------------------------------------ Tom Handley New Age Communications Since '75 before "New Age" and no one around here is waiting for UFOs ;-)