Hi. Just a few things... First, what processor ? > DISPLAY > movwf _w ; Save > swapf status,w ; Save > movwf _status ; Save > bcf intcon,2 ; Clear interrupt bit Use the builtin bit-names instead of "2". And move this to the line right before RETFIE. The rest of first code snipped worked, you said... Second code snippet... > > DISPLAY > movwf _w ; Save > swapf status,w ; Save > movwf _status ; Save > bcf intcon,2 ; Clear interrupt bit > > movfw LOOP ; LOOP to w > call DIGIT_T > movwf portb > > LOOPDEC > decfsz LOOP ; Equal to 0? > goto $+3 ; No, leave and do it again later. Generaly speaking,m try to avoid the "$" thing. By using lables the code is easier to read. > movlw d'3' ; Yes, reinitialize LOOP variable. > movwf LOOP ; Yes, reinitialize LOOP variable. > > swapf _status,w ; Restore. > movwf status ; Restore. > swapf _w ; Restore. > swapf _w,w ; Restore. > retfie ; Return. > > ****Tabel located in main code****** Now, the table isn't realy "located" in any "code". It's just a peice of code someware... > DIGIT_T ; 3 digit display table > addwf pcl,f ; Jump into lookup table > ; _____321' > retlw b'11111011' ; Segment 3 > retlw b'11111101' ; Segment 2 > retlw b'11111110' ; Segment 1 Depending on the processor (> 2 Kwords flash) you *could* have a PCLATH problem here. > > With the code above, portb bits 0, 1, & 2 are on all the time. It's a > simple lookup table yet I can't see what I did wrong. > Third code snippet... > > DISPLAY > movwf _w ; Save > swapf status,w ; Save > movwf _status ; Save > bcf intcon,2 ; Clear interrupt bit > > bsf portb,0 ; Turn off 100 digit > bsf portb,1 ; Turn off 10 digit > bsf portb,2 ; Turn off 1 digit > > movfw LOOP ; LOOP to w > sublw d'3' ; 3 - LOOP in w > btfss status,2 ; LOOP = 3? > goto LOOPDEC ; No, leave. > bcf portb,2 ; Yes, turn on 100 digit > goto LOOPDEC ; Yes, leave. This part will *always* jump to LOOPDEC. The code for digit 2 and 1 below will never run, no matter what the value of LOOP is. The first "goto LOOPDEC" should probably jump to the code below. And the same with the first "goto LOOPDEC" below. If LOOP isn't "3", you should not leave, you should test if LOOP is "2", right `? > > movfw LOOP ; LOOP to w > sublw d'2' ; 2 - LOOP in w > btfss status,2 ; LOOP = 2? > goto LOOPDEC ; No, leave. > bcf portb,1 ; Yes, turn on 10 digit > goto LOOPDEC ; Yes, leave. > [snipped rest...] -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist