hi Paul, may be 'cause you are setting the BRGH bit. If you read the microchip "mid range mcu" manual, page 18-22, you see that there is a "silicon bug" :-))))) --- Paul A Brown scritto: > I have some questions regarding the use of the > hardware serial port on a > PIC16F876. All I want to do is initialize tbe > serial port to 9600 baud, > asynchronous and spew out some data. I have looked > at this code until my > eyes hurt, but to no avail. Could somebody point > out where I am going > wrong? Does anyone have any sample transmit or > receive code for the > hardware serial ports that they would like to share? > > Thanks, > > Paul Brown > > > ; Registers > Cntr equ 0x20 > > > ;Initialize variables > clrf Cntr > > > ;Initialize serial port > SerInit > bsf RCSTA, SPEN > bsf STATUS, RP0 > bcf TXSTA, SYNC ;Asynchronous > transmission > bsf TXSTA, BRGH ;Baud rate generator to > high speed > movlw 129 > movwf SPBRG ;Set BRG for 9600 buad. > bsf TXSTA, TXEN ;Enable transmit > bcf STATUS, RP0 > > ;Main Program Loop > MainLoop > bsf STATUS, RP0 > btfsc TXSTA, TRMT ;Check for data sent > goto TxData > goto MainLoop > > > ;Increment Counter and Transmit > TxData > bcf STATUS, RP0 > incf Cntr, 1 > movf Cntr, 0 > movwf TXREG > goto MainLoop > > end > > ___________________________________________________________________ > Get the Internet just the way you want it. > Free software, free e-mail, and free Internet access > for a month! > Try Juno Web: http://dl.www.juno.com/dynoget/tagj. > === Giacomo Schieppati, e-mail: gschieppati@yahoo.it e-mail URGENTI: gschieppati@i.am e-mail alcooliche: giac@beer.com ICQ: 34514036 ______________________________________________________________________ DO YOU YAHOO!? Il tuo indirizzo gratis e per sempre @yahoo.it su http://mail.yahoo.it