> Is this correct now for the 16f876? > > CBLOCK H'20' ; set up general registers starting at > ; address 32 Yup Could I suggest an alternative way to write this ? > movlw B'00000000' ; all bits low in W > BSF STATUS,RP0 > MOVWF TRISA ; make all bit of PORT A outputs ... > MOVWF TRISB ; and all bits of PORT B also > movlw B'00000101' ; TMR0 assigned to incr. on internal clk > BCF STATUS,RP0 > ; prescalar assigned to TMR0 and set 1:64 > ; bit 5 set means timer runs off RA4 > BSF STATUS,RP0 > MOVWF OPTION_REG ; W inserted into OPTION register >BCF STATUS,RP0 > ; check OPTION register in data sheet banksel trisa ;switch to bank1 clrf trisa ;set A and B as all outputs clrf trisb movlw b'00000101' movwf option_reg You also need to set the analogue/digital status of PortA. This can be found in Section 11 of DS30292B (F87x manual) movlw b'00000110' ;set to all digital movwf adcon1 banksel porta ;switch back to bank0 > again: movlw D'255' ; set up a counter to count down from 255 > movwf counter > incf PORTB, f ; add 1 to port B, (next binary byte) > decfsz counter, f ; decrement counter, skip if zero > goto loop ; if counter not zero, wait on T0IF again > goto again Could be re-written as clrf counter again incf portb ;"f" is default decfsz counter goto loop goto again because when decfsz counter is true, counter=0 and then you'd jumped to a movlw 255 movwf counter, which is extraneous, unless you actually wanted to skip a procedure when counter=0. Otherwise just clear it once and let it repeatedly roll under on its own. In your case you don't even really need to initially clear it, but actively clearing variables can be a good practice (especially if they pop up in other routines and you get unexpected results) -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics