I was taught the following convention when it comes to ISR's I have an ISR which monitors the Interrupt bits, and that calls a = Interrupt handler. So the ISR is only called when an interrupt signal is = received by the micro and causes it to start reading code at specified = at the interrupt vector. This is what I remember from my classes on = 80x86 micro's, this is my first PIC project and my first programming in = the "real world" Charles K Roberts II ORNL-SNS Project -----Original Message----- From: Roberts II, Charles K.=20 Sent: Monday, September 22, 2003 4:32 PM To: PICLIST@MITVMA.MIT.EDU Subject: [PIC:] Interrupt to read ASCII charchters in PIC16F873A on = RS232 I am working on an Interrupt driven Rx routine to read a string of ASCII = charchters on RS232 through the UART for a PIC16F873A. The code is to = read the charchters in RCREG to see if it is a valid start charchter, = which is a # or a ?, and then write it to Rx_Buffer. It also checks for = a LF which is the end of the string. Below is the routine.=20 RX_INT_HANDLER BANK0 BTFSS RCSTA,OERR ; test if overrun GOTO RX_1 BCF RCSTA,CREN BSF RCSTA,CREN ;reset error MOVF RCREG,0 ;dummy read CLEAR CLRF Rx_Num RETURN EXIT BSF Os_Action,RX_CMD GOTO CLEAR RX_1 BSF PORTC,5 ;AFTER THIS POINT IT GETS LOST!!!!! MOVF RCREG,0 ;READS RCREG XORLW 0x3F ;TESTS TO SEE IF ITS A ? BTFSS STATUS,Z GOTO NEXT_TEST ;IF NOT ? GOES TO TEST FOR # XORLW 0x3F ;UNDO'S XOR GOTO WRITE ;WRITES w TO Rx_Buffer R2 XORLW 0x23 WRITE ;CODE TO WRITE (W)TO Rx_Buffer MOVLW Rx_Num ADDLW Rx_Buffer MOVWF FSR MOVF RCREG,0 MOVWF INDF INCF Rx_Num,1 GOTO READ_MORE NEXT_TEST XORLW 0x3F ;UNDO'S XOR XORLW 0x23 ;TESTS FOR # BTFSC STATUS,Z=09 GOTO R2 ;WRITES W TO Rx_Buffer IF A # XORLW 0x23 MOVF Rx_Num,1 ;TESTS IF WE ALREADY HAVE A VALID START = CHAR BTFSC STATUS,Z GOTO CLEAR ;IF NOT A VALID START CHAR CLEARS OUT=20 GOTO READ_MORE ;IF VALID START CHAR HAS BEEN RECEIVED = GOTO READ MORE READ_MORE XORLW 0x20 ;TESTS IF IT IS A CR BTFSC STATUS,Z GOTO EXIT ;IF IT IS A CR GOES TO EXIT=20 XORLW 0x20 ;UNDO'S XOR GOTO WRITE ;WRITES VALUE IN RCREG I am using a modified version of Tony K=FCbek's routine to set up the = ports and USART. I have been using a spare bit on a PORTC as a flag, to = see how far along the program is going. When there is data on the RX = line of the micro it sets the RCIF bit and it goes to the start of my = code. From there it does not go any farther. What am I doing wrong? Charles K Roberts II ORNL-SNS Project -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu