Thanks for the suggestions, now I adapted the code :) In fact, now I put directly the value 25 in SPBRG, which is for 9600 baud rate, at 4 MHz (that's what I understood from a microchip application note). Is this value correct for my setup ? The TX interrupts are enabled when the send buffer has something and disabled when empty. The code for the ISR is inspired from an example from HT-PIC C Compiler, so I thought it is correct. If I deactivate the flag in the main loop, is it correct ? if(RCIF) { led2_on(); receivebuffer[RecvBufferPos] = RCREG; if ((++RecvBufferPos)==MAXRECEIVEBUFFER) RecvBufferPos = 0; led2_off(); } if(TXIF && TXIE) { led1_on(); TXREG = sendbuffer[SendBufferPos]; if ((++SendBufferPos)==MAXSENDBUFFER) SendBufferPos=0; led1_off(); } sci_CheckOERR(); I tried all this, but still, it is not functioning :( It acts like it ignores the serial part, the links are not blinking when they should (they are supposed to blink when a byte is transmitted). Any ideas are welcomed. Lucian -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of piclist@XARGS.COM Sent: 4 octombrie 2003 19:07 To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: 16F628 USART Problem On Sat, 4 Oct 2003, Lucian wrote: > tmp = 16UL * baud; > X = (int)(XTAL/tmp) - 1; How are "tmp" and "X" declared? How is "XTAL" defined? > TXIE = 1; /* enable tx interrupts */ You don't want to turn on transmit interrupts until you have something to transmit. Is your transmit buffer initialized at this point? > if(TXIF && TXIE) > { > led1_on(); > if(SendBufferPos == SendBufferRecPos) > TXEN = 0; You wouldn't normally want to disable the transmitter in your ISR, because the transmitter is still active after your ISR has finished loading bytes into TXREG. > sci_PutByte(sendbuffer[SendBufferPos]); What does this function do? You don't need to call a function to place a byte in TXREG. -- John W. Temples, III -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads Lucian ---- Home, no matter how far... http://www.home.ro -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads