Hi All,=20 I'm new to PICs and am trying to "port" my Z80 assembler skills to something that belongs in this century but am having problems with my test program. =20 Here it is: LIST p=3D16f877,c=3D140 include "p16f877.inc" =20 =20 org 0 clrf STATUS goto BootStart org 4 ISR goto 5 ; Setup Interupt Address org 5 =20 BootStart =20 clrf PORTB =20 bsf STATUS,RP0 ; set Page 1 for TRIS registers movlw b'00000000' movwf TRISB ; set PORTB for all outputs =20 bcf STATUS,RP0 ; back to page 0 =20 LoopAgain ;movlw 0x00 ;movwf PORTB ; All PORTB bits off ;movlw 0xFF ;movwf PORTB ; All PORTB bits on =20 incf W, 0 ; W =3D W + 1 movwf PORTB ; PORTB =3D W goto LoopAgain =20 end =20 =20 Now I thought that 'incf W, 0' would perform a W=3DW+1 operation, and = that when it reached 255, it would simply start from 0 (since it's an 8-bit register), but this doesn't seem to be the case. If I use the 4 commented lines instead of the 3 lower ones, then I get a nice square wave on all 8 I/O pins, so I know the PIC is working and that my programmer is ok etc. =20 All I expect the above test program to do is count in binary flashing 8 LEDs.... =20 So what stupid thing am I doing wrong... =20 Any help much appreciated, Joe =20 -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads