This is a multi-part message in MIME format. ------=_NextPart_000_0022_01C19475.AEFBB320 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hello everyone, I am trying to establish a connection between a 16F627 and my PC. I have already done it (with the help of Tony Nixon), but the caracters I send from the PIC, are received in a wrong manner on the PC: PIC sends: PC receives: C y D w E u F s They appear in the PC, shifted one position lo the right, and inverted. I send attached the code that Tony wrote. Can anyone help me ? Thanks.- ------=_NextPart_000_0022_01C19475.AEFBB320 Content-Type: application/octet-stream; name="rs232.asm" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="rs232.asm" Title "RS232 TEST" ; list P =3D 16F627 ; include "P16F627.inc" ; ; Internal oscilator at 4MHz ; errorlevel -(305), -(302), -(306) ; ; ------------------ ; CONFIGURATION FUSE ; ------------------ ; __CONFIG _CP_OFF & _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON = &_BODEN_OFF & _LVP_OFF & _MCLRE_ON Org 0000h bsf STATUS,RP0 bsf PCON,OSCF ; -> 4Mhz Start bcf STATUS,RP0 movlw b'00000000' movwf PORTA movlw b'00000100' movwf PORTB bsf STATUS,RP0 movlw b'00000000' movwf TRISA movlw b'00000010' movwf TRISB ; ; ----------------------- ; DISABLE THE COMPARATORS ; ----------------------- ; movlw b'00000111' ; disable comparators movwf CMCON ; ; ---------------- ; INITIALISE USART ; ---------------- ; Boot Baud Rate =3D 9600, No Parity, 1 Stop Bit ; bsf STATUS,RP0 movlw d'25' ; 9600 baud movwf SPBRG 40 movlw b'00100100' ; brgh =3D high (2) movwf TXSTA ; enable Async Transmission, set brgh bcf STATUS,RP0 bsf RCSTA,SPEN bsf STATUS,RP0 bsf TXSTA,TXEN ; wait a short while before using bcf STATUS,RP0 ; RAM Page 0 movlw 'A' ; movwf 0x71 rlf 0x71,1 comf 0x71,1 movfw 0x71 movwf TXREG call TransWt movlw 'B' movwf TXREG call TransWt movlw 'C' movwf TXREG call TransWt movlw 'D' movwf TXREG call TransWt movlw 'E' movwf TXREG call TransWt movlw 'F' movwf TXREG call TransWt movlw 'G' ; movwf TXREG call TransWt movlw 'H' movwf TXREG call TransWt movlw 'I' movwf TXREG call TransWt movlw 'J' movwf TXREG call TransWt movlw 'K' movwf TXREG call TransWt movlw 'L' movwf TXREG call TransWt Here goto Here ; ; ------------------------------------ ; WAIT UNTIL RS232 IS FINISHED SENDING ; ------------------------------------ ; TransWt bsf STATUS,RP0 WtHere btfss TXSTA,TRMT ; TX complete if hi goto WtHere bcf STATUS,RP0 ; RAM Page 0 return end ------=_NextPart_000_0022_01C19475.AEFBB320-- -- 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