t'would be simpler/faster still if you were to use the B3..B0 pins as both the 'control' variable and 'control' I/O;
Code:
RES_VECT CODE 0x0000 ; processor reset vector
GOTO START ; go to beginning of program
; TODO ADD INTERRUPTS HERE IF USED
MAIN_PROG CODE ; let linker place main program
START
movlw 0x30 ; B7..B4 other I/O, B3..B0 = control
movwf LATB ;
lopo
incf LATB,W ; B3..B0 bits = control, 0..15
xorwf LATB,W ; wreg = differences
andlw 0x0F ; ignore B7..B4 bits (and control mod 16 for free)
xorwf LATB,F ; update B3..B0 bits, 0..15
GOTO lopo
Bookmarks