S Suraj143 Active Member May 13, 2016 #1 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
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
D Diver300 Well-Known Member Most Helpful Member May 14, 2016 #2 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 - - - -
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 - - - -
S Suraj143 Active Member May 14, 2016 #3 NOP. "dt" is an assembler directive.It represents "Retlw".Its an easy way of writing lengthy tables in single line blocks.
NOP. "dt" is an assembler directive.It represents "Retlw".Its an easy way of writing lengthy tables in single line blocks.
D Diver300 Well-Known Member Most Helpful Member May 14, 2016 #4 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.
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.
P Pommie Well-Known Member Most Helpful Member May 14, 2016 #5 If Index is zero then the addwf PCL,f will execute forever. Mike.