A little more thought reduces it further,no need at all for a shadow working reg at all
works perfectly on the simulator steps through all 16 "control" states on latb 4-7 and preserves latb 0-3.
Code:; TODO INSERT CONFIG CODE HERE USING CONFIG BITS GENERATOR Processor 18f4550 include "p18f4550.inc" TRUE equ 1 FALSE equ 0 cblock 0x30 control ;latb_shadow endc 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 0f MOVWF control MOVLW 3 MOVWF LATB,A lopo BANKSEL control INCF control,F MOVLW 0xf ANDWF control,F MOVF LATB,A,W ANDLW 0XF SWAPF WREG,F IORWF control,W SWAPF WREG,F MOVWF LATB ,A GOTO lopo




Bookmarks