On Fri, Feb 01, 2002 at 10:16:37PM +1100, Sean Alcorn - Avion Sydney wrote: > Hi guys, > > I am a newbie, but am starting to have some reasonable success. > > To me, this code looks right, but it's just not working for me. Instead of > getting 6 loops of my code, I get heaps of them! > > RADIX DEC > ;etc > > > > MOVLW 6 ;We want to do this thing 6 times > MOVWF COUNTER > LOOP > ; Do some stuff > CALL DELAY500; Delay 500ms > ; Do some more stuff > CALL DELAY500; Delay 500ms > DECFSZ COUNTER, F > GOTO LOOP > > I eventually leave this loop, but after significantly more than 6 cycles. > What have I done wrong? It's like I have the wrong figure in the MOVLW 6 > statement. One quick suggestions is to remove the contents of the loop and test the functionality in isolation. The code looks correct at first glance. So I'd bet that something in the "Do some stuff" or in the DELAY500 is affecting counter. Have you tested your code with a simulator? BAJ -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads