Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

New Articles From Microcontroller Tips

Back
Top