Short: clrf FSR0L clrf FSR0H (or LFSR 0,0) loop: clrf POSTINC0 btfsc FSR0H,3 bra loop Faster: clrf FSR0L clrf FSR0H (or LFSR 0,0) loop: clrf POSTINC0 clrf POSTINC0 clrf POSTINC0 clrf POSTINC0 clrf POSTINC0 clrf POSTINC0 clrf POSTINC0 clrf POSTINC0 btfsc FSR0H,3 bra loop ----- Original Message ----- From: "Scott Dattalo" To: Sent: Monday, August 19, 2002 2:13 PM Subject: [PIC]: Challenge: 18F Clear RAM > All this talk about the 18F parts warrants a challenge. A useful snippet > every programmer should have is a Clear Ram one. > > Challenge: > > Write a program to clear the RAM in an 18f452 (or any 18X part with RAM > from 0x000 through 0xf7f). Minimize the # of CPU cycles and limit the > snippet to 12 instructions. > > I've got 2 - a slow, but short routine, and a fast, but long one. > > Scott > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu