Lars Johansson wrote The problem is that when I turn on the power to the circuit, it's sometimes completly dead. If I then turn the power on and off a few times, it (randomly) start's to work again!!?? Snip The following section of code is part of the startup code for a '57 and I had a similar iritation until i simulated it with random info in the registers it somtimes crashed I traced it to the FSR not initalising properly and the program jumping into the subroutienes and never coming back while trying to clear the RAM. Check FSR is cleared before trying to use it. INIT BCF STATUS,PA0 ; SET TO PAGE 0 BCF STATUS,PA1 ; DO IT CLRW ; CLEAR W TO SET PORTA TO O/P TRIS PORTA ; TRIS PORTA TO MAKE IT O/P ;the fix for two days headache..... MOVWF FSR ; FIX FOR FSR B5,6 TO 0 BY SMS 20-1-97 MOVLW B'0111' ; SET CONTENTS OF PORTA MOVWF PORTA ; DO IT MOVLW B'01111000' ; SET CONTENTS OF PORTC MOVWF PORTC ; DO IT MOVLW B'10000001' ; SET I / O OF PORTC TRIS PORTC ; DO IT MOVLW .22 ; LOAD LAST RAM REGISTER WITH 22 MOVWF LAST_REG ; DO IT MOVLW MEMBASE ; LOAD FIRST RAM ADDRESS INTO FSR REG MOVWF FSR ; DO IT CLR_REG CLRF INDF ; CLEAR THE RAM REG POINTED TO BY FSR REG INCF FSR,F ; INC FSR DECFSZ LAST_REG,F ; DEC LAST_REG COUNTER GOTO CLR_REG ; LOOP BACK UNTIL COUNTER IS ZERO CLRF LAST_REG ; CLEAR THE LAST_REG LOCATION CLRF FSR ; CLEAR THE FSR REG