Table Read Hangs - PIC12F675

Status
Not open for further replies.

Suraj143

Active Member
In PIC12F675 I cant read a table where it is placed in a different page.The program hangs.

Code:
incf        Index,F
        movlw        High Table_Seq
        movwf        PCLATH
        movf        Index,W
        call        Table_Seq
        movwf        T_Blue
        ---
        ---

        org    0x200
Table_Seq    addwf    PCL,F
        dt   0
        dt   1, 0, 128,0  ,0
        dt   1, 0, 128,128,0
        dt   1, 0, 0  ,128  ,0
        dt   1, 0, 0  ,128,128
        dt   1, 0, 0  ,0,128
        dt   1, 0, 128,0,128
        dt   1, 0, 128,128,128
 
I think you need to use the retlw command, so your table should be:-
Code:
Table_Seq    addwf    PCL,F
        retlw   0
        retlw  1
        retlw   0
        retlw   128
        retlw   0
        retlw   0
        retlw   1
        retlw   0
        retlw   128
        retlw   128
        retlw   0
        -
        -
        -
        -
 
NOP.

"dt" is an assembler directive.It represents "Retlw".Its an easy way of writing lengthy tables in single line blocks.
 
I wasn't familiar with that directive, and it does assemble to the individual retlw lines.

It runs on a simulator fine for me.

There isn't any limit for Index. The table is 36 entries long and you don't seem to have any trap to stop the call happening if w is larger than 35.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…