Truncated match.
PICList
Thread
'No More PCLATH Problems'
1997\09\29@143734
by
Lee Hewitt
|
Hello All,
Well thanks to Andy Warren and indeed all the members of the
PICLIST who sent replies to my PCLATH problem, I have finally managed to get
my code to work; I can now reliably cross page boundaries when processing
long text strings - brilliant. The problem was actually in the write_string
subroutine which Andy managed to spot; I would have never thought to modify
the PCLATH register here since the number of entries in the 'jump table' was
so little in comparison with the those of the actual text string look-up
tables.
Actually the code which I recently sent to PICLIST was in fact the
wrong version; I have been struggling so much attempting to solve the problem
that I ended up at the stage where I was 'trying anything' without really
thinking, and in my panic I sent a version which incorrectly included the BSF
PCLATH,0. Just in case anyone on the list incorrectly thinks that the
exclusion of this instruction was the solution to my problem, then I have
included the subroutines of my working code.
As I become more proficient with the PIC assembly language, I will
make a positive effort to help other members of the PICLIST solve their
problems.
Many thanks to all members, and best wishes: Lee Hewitt (Manchester ENGLAND)
write_string
clrf char_ptr ;Clear character pointer to zero
movwf msg_ptr ;Load message pointer with message number
ws1: movlw high (JUMP_TABLE)
movwf PCLATH
clrc ;Clear carry 'f
lag in status
register'
rlf msg_ptr,w ;Multiply by two
to prevent
pointing to goto
addlw low (JUMP_TABLE) ;Computed GOTO string pointer
btfsc STATUS,C
incf PCLATH,f
movwf PCL
JUMP_TABLE:
call string0 ;Get next character in the string
goto ws2 ;Upon return call ws2 to step through characters
call string1
goto ws2
call string2
goto ws2
call string3
goto ws2
call string4
goto ws2
call string5
goto ws2
call string6 ;fall into ws2 upon return
ws2: movwf temp1 ;store char returned from table in temp1
xorlw EOMSG ;test for end of message marker (0x04)
btfsc ZERO ;Zero set iff EOM is detected
return ;End Of Message marker detected, thu
s return
movf temp1,w
xorlw EOLN ;Test for EOL marker
btfsc ZERO
goto new_line_1
movf temp1,w
call send_lcd_char
tst incf char_ptr,f
goto ws1
new_line_1 movlw NW_LINE ;send new line command to display
call send_lcd_cmd
call short_delay
goto tst
;Text string look-up tables
string0
bcf PCLATH,0
movlw high (TABLE_0) ;Load HIGH byte
movwf PCLATH
movlw low (TABLE_0) ;Load LOW byte
addwf char_ptr,w
btfsc STATUS,C
incf PCLATH,f
movwf PCL
TABLE_0 dt "*** Power On ***",EOLN," Master Reset ",EOMSG
string1 bcf PCLATH,0
movlw high (TABLE_1) ;Load HIGH byte
movwf PCLATH
movlw low (TABLE_1) ;Load LOW byte
addwf char_ptr,w
btfsc STATUS,C
INCF PCLATH,f
movwf PCL
TABLE_1 dt "Waiting For SOH",EOLN,"From Host PC ...",EOMSG
string2 bcf PCLATH,0
movlw high (TABLE_2) ;Load HIGH byte
movwf PCLATH
movlw low (TABLE_2) ;Load LOW byte
addwf char_ptr,w
btfsc STATUS,C
INCF PCLATH,f
movwf PCL
TABLE_2 dt " Connection Has ",EOLN,"Been Established",EOMSG
string3 bcf PCLATH,0
movlw high (TABLE_3) ;Load HIGH byte
movwf PCLATH
movlw low (TABLE_3) ;Load LOW byte
addwf char_ptr,w
btfsc STATUS,C
INCF PCLATH,f
movwf PCL
TABLE_3 dt "Waiting For STX",EOLN,"From Host PC ...",EOMSG
string4 bcf PCLATH,0
movlw high (TABLE_4) ;Load HIGH byte
movwf PCLATH
movlw low (TABLE_4) ;Load LOW byte
addwf char_ptr,w
btfsc STATUS,C
INCF PCLATH,f
movwf PCL
TABLE_4 dt "Receiving Config",EOLN," Data From Host ",EOMSG
string5 bcf PCLATH,0
movlw high (TABLE_5) ;Load HIGH byte
movwf PCLATH
movlw low (TABLE_5) ;Load LOW byte
addwf char_ptr,w
btfsc STATUS,C
INCF PCLATH,f
movwf PCL
TABLE_5 dt "Waiting For EOT",EOLN,"From Host PC ...",EOMSG
string6 bcf PCLATH,0
movlw high (TABLE_6) ;Load HIGH byte
movwf PCLATH
movlw low (TABLE_6) ;Load LOW byte
addwf char_ptr,w
btfsc STATUS,C
INCF PCLATH,f
movwf PCL
TABLE_6 dt " Data Transfer ",EOLN," *** Complete ***",EOMSG
******* End Of Program *******
1997\09\29@173828
by
Eric van Es
|
Lee Hewitt wrote:
> Hello All,
> Well thanks to Andy Warren and indeed all the members of the
> PICLIST who sent replies to my PCLATH problem, I have finally managed to get
> my code to work; I can now reliably cross page boundaries when processing
> long text strings - brilliant.
Yes, I'm sure this is one piece of code you wont forget soon <G>!
> Actually the code which I recently sent to PICLIST was in fact the
> wrong version; I have been struggling so much attempting to solve the problem
> that I ended up at the stage where I was 'trying anything' without really
> thinking,
...argh! Been there too :-(
> and in my panic As I become more proficient with the PIC assembly
language, I will
> make a positive effort to help other members of the PICLIST solve their
> problems.
>
Oooh I can think of a couple... one of which is my re-surfacing LCD
trouble......
Cheers!
--
Eric van Es | Cape Town, South Africa
spam_OUTvanesTakeThisOuT
ilink.nis.za | http://www.nis.za/~vanes
LOOKING FOR TEMPORARY / HOLIDAY ACCOMODATION?
http://www.nis.za/~vanes/accom.htm
More... (looser matching)
- Last day of these posts
- In 1997
, 1998 only
- Today
- New search...