Hi All I have used the code that Anders M. J. send me and modified my own code = with it BUT it doesnt work !=20 What i want the below code to do is: do the "thing" 50 times (0x32 in hex) and do nothing (end program)=20 BUT: The program keeps repeating it self to infinity and i didnt specify that = anywhere (i think) Please help me. Best regards lasse madsen list p=3D16f84=20 radix hex =20 porta equ 0x05=20 org 0x000 =20 start movlw 0x00 =20 tris porta =20 ecount equ 0x0c ncount equ 0x0d mcount equ 0x0e count equ 0x1a counter equ 0x1b ; ; movlw 0xFF movwf counter loop: BCF porta,01 CALL pulse BSF porta,01 CALL farve_1 BCF porta,01 decfsz counter goto loop BCF porta,01 ; ; ; =3D=3D=3D=3D=3D Subprocedure 1 =3D=3D=3D=3D=3D=20 farve_1 clrf mcount clrf ecount movlw 0x09=20 movwf mcount l1 movlw 0x19 movwf ecount d1 decfsz ecount,f goto d1 decfsz mcount,f goto l1 clrf mcount movlw 0x1B movwf mcount a1 decfsz mcount,f goto a1 NOP NOP NOP NOP NOP return=20 ; ; =3D=3D=3D=3D=3D Subprocedure 2 =3D=3D=3D=3D=3D pulse clrf ncount clrf count movlw 0x52=20 movwf count loadn movlw 0x50 movwf ncount decn decfsz ncount,f goto decn decfsz count,f goto loadn return ; end -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu