![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
I cant be bothered commenting it all, but this block of code is meant to 3 print lines of text on a 20x4 hd4470 lcd. the dispmain program clears a counter, sets the cursor position and then calls each routine which prints a line. The 3 line printing routines are exactly the same as each other exept they call a different lookup table and have different labels. The problem i have is when the dispmain program has only the code without the asterisks it works perfectly, however when the other code is entered the pic goes crazy and crashes over and over. can anyone see a problem with it?
Code:
DISPMAIN CALL CLRDISP CLRF COUNT1 MOVLW 0X80 CALL CMD CALL LN1 CLRF COUNT1 MOVLW 0XC0 CALL CMD CALL LN2 CLRF COUNT1* MOVLW 0X94* CALL CMD* CALL LN4* RETURN LN1 MOVF COUNT1,W CALL SCR1 MOVWF TEMP1 SUBLW 0X26 SKPNZ GOTO LNEND1 MOVF TEMP1,W CALL SENDDATA INCF COUNT1,F GOTO LN1 LNEND1 RETURN LN2 MOVF COUNT1,W CALL SCR3 MOVWF TEMP1 SUBLW 0X26 SKPNZ GOTO LNEND2 MOVF TEMP1,W CALL SENDDATA INCF COUNT1,F GOTO LN2 LNEND2 RETURN LN4 MOVF COUNT1,W CALL SCR6 MOVWF TEMP1 SUBLW 0X26 SKPNZ GOTO LNEND4 MOVF TEMP1,W CALL SENDDATA INCF COUNT1,F GOTO LN4 LNEND4 RETURN SCR1 ADDWF PCL,F DT "Speed:&" SCR3 ADDWF PCL,F DT "Temp: &" SCR6 ADDWF PCL,F DT "Mode sets AUTO/MAN&" |
|
|
|
|
|
|
(permalink) | |
|
Quote:
:twisted: |
||
|
|
|
|
|
(permalink) |
|
oh well, screw it. ill rewrite the whole thing and see if if starts working.
|
|
|
|
|
|
|
(permalink) |
|
I would suggest your tables may be crossing a 256 byte boundary, this causes the program counter to jump to the wrong location. It's easiest to move all tables to near the beginning of program memory, and jump over them at the start of the program - or you can move them to the start of a 256 byte boundary in higher memory, and set the PCL bits before calling it.
|
|
|
|
|
|
|
(permalink) |
|
SKPNZ ..
i've never seen this command .. must be a newer pic..? |
|
|
|
|
|
|
(permalink) |
|
Thanks for the help, i thought it might be something like that. ill have a play with it.
SKPNZ is a pseudo-op ,it gets replaced with BTFSC STATUS,2 when it assembles. |
|
|
|
|
|
|
(permalink) |
|
Yep that fixed it, just had to move the tables higher up.
|
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|