I'm working on a school project and I'm just trying to enhance the code now for my own enjoyment and the problem that I'm having is that whenever a variable becomes larger then 32 (hexadecimal), the PIC project seems to just freeze. What is being done is a 'picture' is stored in 1s and 0s (1 will mean an of LED, 0 means on) with one group of 8 (a byte) being one line of the picture (the output is on an 8x8 LED matrix). Since what I'm drawing is longer than 8 lines (69h actually), there is a scrolling function written. The original program had a 16 line image scroll by. This looping function works great until I try to go past 32h. Then it seems to just freeze. Here is the code I have now:


Code:
        TITLE "98-0380-AUS-P (picxie2) V1.00 - (C) 1998 Lewin Edwards ([email protected])"

	INCLUDE "P16F84.INC"

	LIST P=16F84
	__CONFIG B'11111111110001'	;All protection off, powerup timer on, WDT off, XT osc

;--------------------------------------------------------------------------
;	Behavioral constants
DEFAULT_MULTIPLEX_RATE	EQU H'50'	;Multiplex speed. Probably don't need to modify this.
DEFAULT_FRAME_RATE		EQU H'20'	;Default number of times to display frame
SCREEN_HEIGHT			EQU H'08'	;Number of lines on screen
SCREEN_WIDTH			EQU H'08'	;Number of columns on screen
NUMBER_OF_LINES			EQU H'30'	;Number of lines of text to display
REPEATS_DONE			EQU H'02'	;Number of times to do the number of lines given

..
..
..
..
..

;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;	SUBROUTINE	Rotate screen buffer UP one line (top line of
;			offscreen buffer becomes bottom line of onscreen)
;			Scratch0 - line counter
;			Scratch1 - swap holding register
;---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
RotateUp	MOVLW	NUMBER_OF_LINES*REPEATS_DONE
		MOVWF	Scratch0
		
		; Setup destination pointer
		MOVLW	Screen0+1
		MOVWF	FSR
		
		; Save the top line of the display
		MOVF	Screen0,0
		MOVWF	Scratch1		
		
RULoop		MOVF	INDF,0			;get line
		DECF	FSR,1			;locate destination
		MOVWF	INDF			;put line data in new location
		INCF	FSR,1			;locate next line source
		INCF	FSR,1
		DECFSZ	Scratch0,1
		GOTO	RULoop

		MOVLW	NUMBER_OF_LINES
		MOVWF	Scratch0
		DECFSZ	REPEATS_DONE,1
		GOTO	RULoop

		MOVLW	NUMBER_OF_LINES
		
		MOVLW	H'02'
		MOVWF	REPEATS_DONE
		; Restore the top line of the display (now the bottom line)
		MOVF	Scratch1,0
		MOVWF	Screen0+NUMBER_OF_LINES*REPEATS_DONE
You'll notice that I have tried to get around this by only making the NUMBER_OF_LINES 32h, and then repeating that 32h REPEATS_DONE times. This does not freeze, it simply starts showing fully ON lines.


Can anyone show me how to make a variable (maybe the INDF pointer is the problem) go above 32h?

Thanks!