Tabelle implementieren Assembler MPLAB

OP #1970709
Lesenswert?

Hallo!

Bitte um Hilfe!
Ich programmiere den PIC16f88 in MPLAB mit der Sprache Assembler.
Ich hab 2 sehr große tabellen. Jede Tabelle hat die Werte von 0-255.
Nun mein Problem ist dass der PCL überschritten wird und er beim call 
tab irgendwo hinspringt.
Ich muss also die Tabelle implementieren. Dafür gibts auch das 
Datenblatt AN556. Aber ich komme trotzdem nicht weiter.

z.B.:
                          addlw   0x01
        movwf  PCLATH
        movlw  d'7'
        call  tab_timerlow

tab_timerlow    addwf  PCL,f
                retlw  0x00
                .
                .
                .

??
funktioniert aber nicht!
Bitte um Hilfe. Eventuell den Programmteil kurz posten !
Danke schon im Voraus!

LG Lukas H.
Gast #1970721
Lesenswert?

So sollte es funktionieren.
1
    movlw   d'7'
2
    movwf   address
3
    call    tab_timerlow
4

5

6
tab_timerlow
7
    movlw   high tablestart
8
    movwf   PCLATH 
9
    movlw   low tablestart
10
    addwf   address, w 
11
    btfsc   STATUS, C
12
    incf    PCLATH, f
13
    movwf   PCL
14
tablestart
15
    retlw   0
16
    retlw   1
17
    retlw   2

Gruß Flo
Gast #1971013
Lesenswert?

Hallo Lukas,
das ist die Adresse (high- und lowbyte) des Labels 'tablestart' und 
damit die Adresse vom ersten Wert der Tabelle, hier: 'retlw  0'.
Du brauchst dich nicht darum zu kümmern, das macht der Compiler.

Gruß
John

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren