Clearing RAM in PIC18Fxxx

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

Reply to
PigPOg
Loading thread data ...

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

Reply to
Rocky

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

Simon

Reply to
PigPOg

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

Reply to
PigPOg

What was the problem?

Reply to
Tom Lucas

I had the wrong Watch window open. Whoops.

Reply to
PigPOg

That'll do it every time!

Reply to
Tom Lucas

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.