Clearing RAM in PIC18Fxxx

Oct 15, 2007 6 Replies

I'm trying to clear RAM (to 00 hex) in Bank 0, registers 00 -> 7F only. But the program only clears up to register 48 hex. I must be doing something wrong. Can anyone advise please? Thanks, Simon.



; ; Clear RAM 00 -> 7FH ; Program only uses BANK0 registers ; CLRF BSR ;Ensure working in Bank0. LFSR FSR0,0x000 ;Initiate to RAM loc. 0 BUMP_RAM CLRF POSTINC0 ;Clear INDF & increment. BTFSS FSR0H,0 ;All done in Bank0? GOTO BUMP_RAM


a) CLRF BSR is unnecessary b) Simulating in MPLAB the above code clears up to 0xFF, as expected. Rocky

Removed CLRF BSR, re-compiled and run. Still only clears up to 48H inclusive! Now I'm really confused.

Simon

Replied rather hastily. Found the problem, thanks Rocky. Simon

I had the wrong Watch window open. Whoops.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required