; Input output test LIST P=18F4550, F=INHX32 ; Specify processor and hex format #include CONFIG FOSC = HS ; Use internal oscillator, RA6 as clock output CONFIG WDT = OFF ; Watchdog Timer off CONFIG LVP = OFF ; Low-Voltage Programming off CONFIG MCLRE = OFF ; MCLR pin disabled, RE3 input enabled R1 EQU 0x020 R2 EQU 0x021 ORG 0x00 ; Program starts at address 0 Start: ; Initialize PORTB CLRF TRISD ; Set all PORTB pins as output CLRF LATD ; Clear PORTB outputs CLRF LATB BCF INTCON2, 7 movlw 0fh ; Set all pins to digital I/0 movwf ADCON1 MOVLW 0xFF MOVWF TRISB loop: movlw 0xff addwf PORTB btfsc STATUS, 0 goto on goto off on: movlw 0x01 movwf PORTD goto loop off: movlw 0x00 movwf PORTD goto loop END ; End of program