PROCESSOR 16F877 ; Define MCU type ; Register Label Equates.................................... PORTB EQU 06 ; Port B Data Register TRISB EQU 86 ; Port B Direction Register Timer EQU 20 ; GPR used as delay counter ; Initialise Port B (Port A defaults to inputs)............. ORG 0X05 ; BANKSEL TRISB ; Select bank 1 MOVLW b'00000000' ; Port B Direction Code MOVWF TRISB ; Load the DDR code into F86 BANKSEL PORTB ; Select bank 0 GOTO reset ; Jump to main loop delay MOVWF Timer ; Copy W to timer register down DECFSZ Timer ; Decrement timer register GOTO down ; and repeat until zero RETURN ; Jump back to main program reset CLRF PORTB ; Clear Port B Data WDT clrwdt INCF PORTB ; Increment output at Port B GOTO WDT ; Repeat main loop always END ; Terminate source code