3BABY
Member level 5
- Joined
- Jan 14, 2011
- Messages
- 91
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- New Zealand
- Activity points
- 2,252
Hi All,
i have a bit of a problem, and cant seem to find an answer..
i have 4 tables in my program all consisting of 128 values..
say TABLE1, TABLE2, TABLE3, TABLE4.. in my ode they are setup like this:
then i use
the problem i have is if i call TABLE2 and add 252 to the program counter i dont get my desired value.. the PC jumps into TABLE1 and returns me the 128th value from there.. obviously its a problem with my ORG statements or the place where ive put the tables.. but i cant seem to work it out..
any help would definitely save me from going bald..
i have a bit of a problem, and cant seem to find an answer..
i have 4 tables in my program all consisting of 128 values..
say TABLE1, TABLE2, TABLE3, TABLE4.. in my ode they are setup like this:
Code:
TABLE1 ORG d'512'
ADDWF PCL, F
RETLW b'00000100'
.
.
... to 128 RETLW's
TABLE2 ORG d'1536'
ADDWF PCL, F
RETLW b'00000100'
.
.
... to 128 RETLW's
TABLE3 ORG d'2048'
ADDWF PCL, F
RETLW b'00000100'
.
.
... to 128 RETLW's
TABLE4 ORG d'2560'
ADDWF PCL, F
RETLW b'00000100'
.
.
... to 128 RETLW's
then i use
Code:
MOVLW d'252' ;for testing
BCF PCLATH, 0
BSF PCLATH, 1
CALL TABLE2
the problem i have is if i call TABLE2 and add 252 to the program counter i dont get my desired value.. the PC jumps into TABLE1 and returns me the 128th value from there.. obviously its a problem with my ORG statements or the place where ive put the tables.. but i cant seem to work it out..
any help would definitely save me from going bald..