On Tue, 3 Jun 1997 15:41:45 PST8 Tim Crist writes: > I'm having problems with some very simple code. The MPLAB 3.22 > simulator seems to stick on 07H in this routine when decrementing > the variable del_y. What am I doing wrong? > > > > ;Initial program setup for PIC84 > > COUNT EQU 008H ;Tim's Counter DEL_Y constant > DEL_Y EQU 00H ;Tim's DEL_Y Variable 00H is not a valid RAM location. It is the INDF special-function register. You need to move the DEL_Y variable to a general purpose file register. Consult the memory map in the data book for the particular model of PIC you are using to find an appropriate address. Location 0x20 works in most all PICs except the 16C5x series. > > > ;some more program stuff... > > > MOVLW COUNT ;Put the COUNT in W >(accumulator) > MOVWF DEL_Y ;Move COUNT to f (DEL_Y) > COUNTR DECFSZ DEL_Y,F ;F-1 --> DEL_Y > GOTO COUNTR; ;*** Simulator gets stuck >between > ;*** here and "COUNTR" > Exactly what is likely happening is the FSR is 0, so you are trying to read INDF indirectly, which the book says will always return 0. If you break the program before the first decrement, you will find that the write didn't take. So the decfsz never skips, because 0 decrements to 0xff, which is never 0. -Mike