> trisc.6 = 0; // Set TX pin for output. > trisc.7 = 1; // Set RX pin for input. > spbrg = 51; // 9600 baud at 20MHz clock. > txsta.BRGH = 1; // 1 = High baud rate. > txsta.SYNC = 0; // 0 = async. > rcsta.SPEN = 1; // 1 = Enable the serial port hardware. > txsta.TX9 = 0; // 0 = No 9th bit. > txsta.TXEN = 1; // 1 = Enable transmission. Ian, my code for an 18F452 and 18F1320. Maybe you can spot something 18F452 ; 9600 with BRGH = 1 @ 39.3216MHz ; X = ( (39321600 / 9600) / 16 ) -1 ; X = ( 39321600 / (9600 * 16) -1 ; X = 255 comms mov .255,spbrg movlw b'00100100' ;brgh=1, Asynch, 8-bit, Tx enabled movwf txsta movlw b'10010000' ;Asynch, 8-bit, Rx enabled movwf rcsta movfw rcreg ;clear receive buffer and rcif movfw rcreg movfw rcreg bcf rcsta,cren ;clear any errors bsf rcsta,cren ;'send character' macro out macro litval ;transmit character from W movlw litval movwf txreg btfss txsta,trmt bra $-2 endm ============== 18F1320 ; 9600, BRGH = 0, BRG16 = 0, 8-bit Asynch @ 8MHz ; X = ( (8000000 / 9600) / 64 ) -1 ; X = ( 8000000 / (9600 * 64) -1 ; X = 12 comms mov .12,spbrg mov b'00100000',txsta ; x ; 0 8-bit ; 1 transmit enabled ; 0 Asynch ; 0 Sync Break ; 0 BRGH = 0 ; xx mov b'00010000',rcsta ; 0 serial port disabled ; 0 8-bit ; x ; 1 enable receiver ; 0 address detection off ; xxx mov b'00000000',baudctl ; x ; 0 Receive operation active ; x ; x ; 0 BRG16 = 8-bit ; x ; 0 no wake-up ; 0 no auto-baud -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist