I am trying to write incoming, ASCII String, data to a block of a memory addresses. I have two "valid start" char and this will start the process. My code is not writing the data to the correct location. Here is my code, do you see what I am doing wrong. The PCALL is from Toney Kuebeck's initialization code. ; *********************************************************************** ; ; RX_INT_HANDLER - handles the received commands on serial com=20 ; called from inside int. ; RX_INT_HANDLER BANK0 =09 BTFSS RCSTA,OERR ; test if overrun bit is set PCALL RX_1 ; if overrun bit is not set then goto RX_1 BCF RCSTA,CREN ; if overrun bit is set then stop continuios receive=20 BSF RCSTA,CREN ;reset error start continuios receive MOVF RCREG,0 ;dummy read CLRF Rx_Num ;clear Rx_Num, removing this makes the wait for Query work? MAD NOP =09 RETURN RX_1 BANK0 ;TEST!! MOVLW Rx_Buffer ;Move Address of Rx_Buffer to W }Rx_Buffer is 16 Bytes ADDWF Rx_Num,0 ;Add Rx_Num to W }Rx_Num is a pointer MOVWF FSR ;Place W (Rx_Buffer + Rx_Num) into FSR } MOVF RCREG,0 ;moves RCREG into W } MOVWF INDF ;copies W into INDF MOVWF Temp ;Copies W into Temp }Copied to temp to prevent MOVF Rx_Num,1 ;Move Rx_Num to Rx_Num }corruption of data BTFSS STATUS,Z ;Check Zero Bit LONG_CALL RX_2 ;If Z bit is not set then jump to=20 MOVF Temp,0 ;Copy Temp into W XORLW 0x23 ;XOR W with 0x23 (#) BTFSS STATUS,Z ;Check Z bit status LONG_CALL NEXT_TEST1 ;If W does not =3D 0x23 then goto NEXT_TEST1 INCF Rx_Num,1 ;If W =3D 0x23 then Rx_Num =3D Rx_Num + 1 LONG_CALL MAD ;GOTO MAD NEXT_TEST1 BANK0 ;TEST!! BSF PORTC,5 MOVF Temp,0 ;Copy Temp into W XORLW 0x3F ;XOR with 0x3F (?) BTFSC STATUS,Z ;Check Status of Z bit RETURN ; If W =3D 0X3F then return INCF Rx_Num,1 LONG_CALL MAD ;Exit's handler RX_2 BANK0 ;TEST!! MOVF Temp,0 ;Copy Temp into W XORLW 0x0A ;is it a LF BTFSC STATUS,Z ;Test Status of Z bit LONG_CALL MORE_CHARS ;no, read in more than BSF Os_Action,RX_CMD ;Set RX_CMD LONG_CALL MAD MORE_CHARS BANK0 ;TEST!! MOVF Temp,0 ;Copy Temp into W XORLW 0xD ;is it a CR BTFSS STATUS,Z ;if so ignore it INCF Rx_Num,1 ;Skip if CR MOVF Rx_Num,0 ;Move Rx_Num to W ANDLW 0xF0 ; W AND 0xF0 BTFSS STATUS,Z ;not zero means more than 16 bytes without terminator=09 CLRF Rx_Num ;start again RETURN ;return Charles K Roberts II ORNL-SNS Project -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu