hi! I am using the 16F877, 4MHz processor. I have this problem with getting the recive(UART) to work. I have = tried too get both the interrupt and polling to work. It used to work so = I guess I just missed something somewhere. when I run the program it = stopps just after GET_DATA after all the INIT:s. it can't get passed the = RCIF flag. this should work without the interrupt(INTCON) set I think. = nothing happens to the interrupt as well. it never goes to the interrupt = vector. I have made macros for the BANK0 and BANK1 and they work. when I = simulate the program with mplab all the reg. works. I am just using = GET_DATA now but want to use interrupts when I get it to work. at the = moment nothing happens. there is no problem to send data(TXD) only to = recive. I have attached the hole program if anyone could be so kind to have a = look at it. thanks. this is just a part of it here in the mail.=20 /nabil ;***** VARIABLE DEFINITIONS w_temp EQU 0x70 ; variable used for context saving=20 status_temp EQU 0x71 ; variable used for context saving S_OUT EQU 0X72 TEST2 EQU 0X74 TEST3 EQU 0X75 S_IN EQU 0X76 S_IN_CHECK EQU 0X77 ORG 0x000 ; processor reset vector CLRF PCLATH ; ensure page bits are cleared GOTO MAIN ; go to beginning of program ORG 0x004 ; interrupt vector location MOVWF w_temp ; save off current W register contents MOVF STATUS,w ; move status register into W register MOVWF status_temp ; save off contents of STATUS register ; isr code can go here or be located as a call subroutine elsewhere =20 BSF PORTB,4=20 =20 MOVF status_temp,w ; retrieve copy of STATUS register MOVWF STATUS ; restore pre-isr STATUS register contents SWAPF w_temp,f SWAPF w_temp,w ; restore pre-isr W register contents =20 RETFIE ; return from interrupt ;****** sends 1 byte to TxD. ********* SEND_DATA =20 MOVF S_OUT,W =20 BANK0 =20 MOVWF TXREG ;txreg fylls med s_out. BANK1 =20 NOT =20 BTFSS TXSTA,TRMT ;tests to se if data sent GOTO NOT ;if not empety go back and try agsain. BANK0 =20 =20 RETURN=20 =20 ;******* recives 1 byte from RxD. ***** GET_DATA =20 BANK0 BSF PORTB,7 EMPTY BTFSS PIR1, RCIF GOTO EMPTY BSF PORTB,6=20 BANK0 MOVF RCREG,W MOVWF S_IN =20 RETURN ;********** Port setup **************** =20 INIT_PORT =20 BANK0 CLRF PORTC =20 CLRF PORTB=20 BANK1 MOVLW H'80' =20 MOVWF TRISC ;bit 7(rx), is input. all the rest is = output. MOVLW H'00' =20 MOVWF TRISB ;all id outputs. BANK0 =20 RETURN INIT_INTERRUPT =20 ;CLRF PCLATH MOVLW B'11000000' ;move h'00' to clear all the interrupts. MOVWF INTCON ;SET ALL INTERRUPTS =20 RETURN ;********** serie port init *********** =20 INIT_SERIE =20 BANK1 MOVLW 0X19 ;4MHz/9600=20 MOVWF SPBRG =20 =20 BCF TXSTA, SYNC BSF TXSTA, BRGH ;sets the high speed transmit. =20 BSF PIE1, RCIE ;sets the recive interrupt ready.=20 BSF TXSTA, CSRC ;too test the transfer BCF TXSTA, TRMT BANK0 BSF RCSTA, SPEN =20 BSF RCSTA, CREN ;needed to recive data. BANK1 =20 BSF TXSTA, TXEN ;make the txreg ready to send data BANK0 RETURN ;************************************* MAIN CALL INIT_PORT ;sets up all the i/o ports. CALL INIT_SERIE ;starts the serie connection. CALL INIT_INTERRUPT ;starts the interrupt. =20 MOVLW H'30' MOVWF S_OUT CALL SEND_DATA START=20 CALL GET_DATA GOTO START END ; directive 'end of program' -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu