Hi again, I'm trying to implement an autobaud usart routine. My ideea was to change the spbrg value register if a frameerror occure. The result is interesting. It work's ok if I switch only from 57600 baud to 19200 baud but if I want to use more than two different baud rate ( ie: 57600, 19200, 9600, 4800, 2400, 1200 ) by counting how many frameerrors appears and change spbrg value (and brgh if necessary ) does not work. Here is my frameerror routine, I know is not the best way to check the counter, have some positive ideeas ? How could be treated an overerror? Thank's, Vasile frameerror: -- if garbage is coming in bcf intcon_gie -- disable interrupts btfsc intcon_gie goto frameerror -- be sure; still necesary ??? -- movf f877_rcreg,w -- reading rcreg clears ferr flag bcf f877_rcsta,ferr -- sure clears ferr!!! incf counter,f -- count how many frame errors take place movf counter,w sublw 2 -- test if counter > 2 btfsc status_c goto b_57600 -- if no try again with other baud rate clrf counter -- if yes reset counter and again b_57600: movf counter,w btfss status_z -- test if counter==0 goto b_19200 -- no, go to another baud rate movlw 10 -- yes, let the baudrate unchanged goto set_spbrg -- brgh is still high b_19200: movf counter,w sublw 1 btfss status_z -- test if counter==1 goto int -- if no, go to ser_in movlw 31 -- if yes set baudrate 19200 goto set_spbrg b_9600: movf counter,w sublw 2 btfss status_z -- test if counter==2 goto int -- if no, go to ser_in movlw 64 -- if yes set baudrate 9600 set_spbrg: bcf status,6 bsf status,5 -- bank1 movwf f877_spbrg -- load spbrg with new baud_rate bcf status,5 -- bank0 int: bsf intcon_gie -- enable interrupts goto ser_in -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics