Hallo Schlapfi.

Da hast du in Sachen Microcontroller anscheinend eine echte Ochsentour durchgemacht! Leider hast du dabei auch eher schlechte Lehrbücher erwischt.

Keinesfalls will ich dein Programm schlecht machen. Schließlich tut es ja, was es soll. Die Sache mit den Tabellen ist aber ein 'gutes' Beispiel für schlechte Lernbeispiele; das Springen mittels GOTO $+x ist gleich das nächste! Beides funktioniert so wie es dasteht, ist aber nicht zur Nachahmung zu empfehlen.

Dass du aus verschiedenen Quellen Material verwendet hast, habe ich schon anhand der verschiedenen Schreibweisen für Konstanten vermutet (z.B. der konstante Wert '06' ist oktal, also auf der Basis von 8 zu interpretieren; diese Darstellungsform wird selten verwendet, hat kaum Nutzwert und kann leicht als dezimal missverstanden werden).

Also nochmals: Ich will dich nicht abbürsten und dein Projekt schlechtmachen, sonden die Probleme aufzeigen, die dort angelegt sind.
Microchip liefert - gut versteckt auf dem PC - für (nahezu) jeden Controller eine Muster-Programmdatei, mit der ich von Anfang an sehr gut gefahren bin.
Das für deinen Controller passende Musterprogramm habe ich gleich hier reingestellt. Als Übung könntest du mal versuchen, dein Projekt in diesen Rahmen einzubauen.

Code:
;**********************************************************************
;   This file is a basic code template for assembly code generation   *
;   on the PIC16F631. This file contains the basic code               *
;   building blocks to build upon.                                    *
;                                                                     *
;   Refer to the MPASM User's Guide for additional information on     *
;   features of the assembler (Document DS33014).                     *
;                                                                     *
;   Refer to the respective PIC data sheet for additional             *
;   information on the instruction set.                               *
;                                                                     *
;**********************************************************************
;                                                                     *
;    Filename:        xxx.asm                                           *
;    Date:                                                            *
;    File Version:                                                    *
;                                                                     *
;    Author:                                                          *
;    Company:                                                         *
;                                                                     *
;                                                                     *
;**********************************************************************
;                                                                     *
;    Files Required: P16F631.INC                                      *
;                                                                     *
;**********************************************************************
;                                                                     *
;    Notes:                                                           *
;                                                                     *
;**********************************************************************


    list        p=16f631    ; list directive to define processor
    #include    <p16f631.inc>    ; processor specific variable definitions


; '__CONFIG' directive is used to embed configuration data within .asm file.
; The labels following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.

    __CONFIG    _FCMEN_ON & _IESO_OFF & _BOR_OFF & _CPD_OFF & _CP_OFF & _MCLRE_ON & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT



;***** VARIABLE DEFINITIONS
w_temp        EQU    0x7D        ; variable used for context saving
status_temp    EQU    0x7E        ; variable used for context saving
pclath_temp    EQU    0x7F        ; variable used for context saving


;**********************************************************************
    ORG     0x000             ; processor reset vector

    nop
      goto    main              ; go to beginning of program


    ORG     0x004             ; interrupt vector location

    movwf   w_temp            ; save off current W register contents
    movf    STATUS,w          ; move status register into W register
    movwf    status_temp       ; save off contents of STATUS register
    movf    PCLATH,w      ; move pclath register into w register
    movwf    pclath_temp      ; save off contents of PCLATH register

; isr code can go here or be located as a call subroutine elsewhere

    movf    pclath_temp,w      ; retrieve copy of PCLATH register
    movwf    PCLATH          ; restore pre-isr PCLATH register contents
    movf    status_temp,w     ; retrieve copy of STATUS register
    movwf    STATUS            ; restore pre-isr STATUS register contents
    swapf   w_temp,f
    swapf   w_temp,w          ; restore pre-isr W register contents
    retfie                    ; return from interrupt



main

; remaining code goes here




; example of preloading EEPROM locations

    ORG    0x2100
    DE    5, 4, 3, 2, 1

    END                       ; directive 'end of program'
Frag einfach, wenn du dort etwas nicht verstehst.

Gruß
Christian.