Angry Badger
Member
Hello,
Hope all you 'forumers' are ok.
I need some help with my program. My program doesn't jump to where I think it should when I add an offset of 0x18 to PCL, in fact the program hangs.
I add the value 0x18 to 0xE0 (PCL) and expect to go to 0xF8. If you look at the attached screenshot I think you will see what I am trying to do.
The prog does a 'GOTO' ok to all days except Saturday. I can't see what's different about that one.
Thanks in advance for any help.
Hope all you 'forumers' are ok.
I need some help with my program. My program doesn't jump to where I think it should when I add an offset of 0x18 to PCL, in fact the program hangs.
I add the value 0x18 to 0xE0 (PCL) and expect to go to 0xF8. If you look at the attached screenshot I think you will see what I am trying to do.
The prog does a 'GOTO' ok to all days except Saturday. I can't see what's different about that one.
Code:
movf day,w ;BCD day of the week number (Sun = 0, Sat = 6)
andlw 0x0f ;clear upper nybble
rlncf WREG,W ;double it
rlncf WREG,w ;and again (because of x2 pc increments)
addwf PCL ;add it (day of week number x4) to prog counter low byte
goto Sunday
goto Monday
goto Tuesday
goto Wednesday
goto Thursday
goto Friday
goto Saturday
Sunday
movlw low dt_sun
movwf lowbyte
movlw high dt_sun
movwf highbyte
goto Msg_count
Monday
movlw low dt_mon
movwf lowbyte
movlw high dt_mon
movwf highbyte
goto Msg_count
Tuesday
movlw low dt_tues
movwf lowbyte
movlw high dt_tues
movwf highbyte
goto Msg_count
Wednesday
movlw low dt_wed
movwf lowbyte
movlw high dt_wed
movwf highbyte
goto Msg_count
Thursday
movlw low dt_thurs
movwf lowbyte
movlw high dt_thurs
movwf highbyte
goto Msg_count
Friday
movlw low dt_fri
movwf lowbyte
movlw high dt_fri
movwf highbyte
goto Msg_count
Saturday
movlw low dt_sat
movwf lowbyte
movlw high dt_sat
movwf highbyte
;goto Msg_count
Msg_count
movf msg_cnt,w
call Day_txt
tstfsz WREG
goto $+8
clrf msg_cnt
return ;leave routine
call lcd_char
incf msg_cnt
goto Msg_count
Thanks in advance for any help.