I'm using printf() to talk directly to EUSART1, without going via the usart.h library. We decided to avoid this library for now in order to keep code as direct and simple as possible. printf() appears to call code in file c:\MCC18\src\pmc_common\USART\_usartpc.asm , which clears SPBRG when first run, causing serial timing to fail. However, if I manually re-set SPBRG in the watch window, it remains uncleared and serial transmission continues happily. Q1) Any idea why this has to happen, and what could/should be done about it? Q2) Does anyone have any optimal examples of setting up printf() explicitly without using usart.h ? Many thanks, Matt ----------------- code follows ------------------------------- #include #include #include // #include void main(void) { // config usart, 9600 8n1, Fosc=18.432MHz // MOVLW b'01000001' // MOVWF TXSTA1,A TXSTA1 = 0b01000001 ; // MOVLW b'11000000' // MOVWF RCSTA1,A RCSTA1 = 0b11000000 ; // MOVLW b'00000000' // MOVWF BAUDCON1,A BAUDCON1 = 0b00000000 ; // CLRF SPBRGH1,A SPBRGH1 = 0 ; // MOVLW d'29' // MOVWF SPBRG1,A SPBRG1 = 29 ; while(1) { printf ("Hello World!\n"); Delay10KTCYx (0); } } -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist