I am using these pics 18F24K22 and 18F2321 have got the look up table working ok an a 16f722 no problem.
Right here is the headache when i call the look up table it always returns with the first line of the look up, it wont add thw W to the PCL, and retlw like it should do.
Even if i pre-load the W with a value it still returns with the first Retlw
here is the ASM file which works ok on the 16F722
WHY WONT IT WORK ON THESE NEW 18F SERIES PICS?
Right here is the headache when i call the look up table it always returns with the first line of the look up, it wont add thw W to the PCL, and retlw like it should do.
Even if i pre-load the W with a value it still returns with the first Retlw
here is the ASM file which works ok on the 16F722
Rich (BB code):
Show_Units
movf UNITS,w
Call Convert
movwf PORTB
bcf PORTC,5 ; Units mux
bsf PORTC,6 ; Tens mux
bsf PORTC,7 ; Huns mux
call Delay
return
Convert
;NOTE CHANGE ADDWF PCL,F TO W TO MAKE LOOKUP TABLE WORK ALSO ON 18F2321
ADDWF PCL,f ; now get dispaly seven segment bits (0= 0n 1= Off)
retlw b'00000011';0 b7=a aaaaa 77777
retlw b'10011111';1 b6=b f b 2 6
retlw b'00100101';2 b5=c f b 2 6
retlw b'00001101';3 b4=d f b 2 6
retlw b'10011001';4 b3=e ggggg 11111
retlw b'01001001';5 b2=f e c 3 5
retlw b'01000001';6 b1=g e c 3 5
retlw b'00011111';7 b0=dp e c 3 5
retlw b'00000001';8 ddddd 44444
retlw b'00011001';9 dp O
; Segment bits PORT bits
***********************************************************************
and this is the ASM for the new pics NOTE I HAVE TO CHANGE THE
ADDWF PCL, F TO ADDWF PCL ,W
or it wont return at all and crashes??
****************************************************************************
Show_Units
movf UNITS,w
Call Convert
movwf PORTB
bcf PORTC,5 ; Units mux
bsf PORTC,6 ; Tens mux
bsf PORTC,7 ; Huns mux
call Delay
return
Convert
;NOTE CHANGE ADDWF PCL,F TO W TO MAKE LOOKUP TABLE WORK ALSO ON 18F2321
ADDWF PCL,w ; now get dispaly seven segment bits (0= 0n 1= Off)
retlw b'00000011';0 b7=a aaaaa 77777
retlw b'10011111';1 b6=b f b 2 6
retlw b'00100101';2 b5=c f b 2 6
retlw b'00001101';3 b4=d f b 2 6
retlw b'10011001';4 b3=e ggggg 11111
retlw b'01001001';5 b2=f e c 3 5
retlw b'01000001';6 b1=g e c 3 5
retlw b'00011111';7 b0=dp e c 3 5
retlw b'00000001';8 ddddd 44444
retlw b'00011001';9 dp O
; Segment bits PORT bits
EVEN IF I PUT THIS LINE IN
it crashes and hangs because of ",F"
" movlw .4"
addwf pcl,f
retlw . xxxxxxxx
retlw .xxxxxxxx
ETC......
OR THIS LINE ,W just returns with first value of retlw?
" movlw .4"
addwf pcl,w
retlw . xxxxxxxx
retlw .xxxxxxxx
ETC......
Last edited: