Hi, I'm currently doing Nigel's Tutorial 3-1 on LCD. In it, i saw this line "ERRORLEVEL 0, -302 ;suppress bank selection messages". After looking at MPASM Assembler Help file, below is the explanation for Error 302.
Umm, how do I phrase the question...?
Ok.. The ERRORLEVEL line above merely suppress the error message but the error is still there. With the ERROR 302 still present, the code still work..
The source of the error is from "movwf LCD_TRIS".
My question is that what is Error 302 or rather, how can a working code contain Error messages...? Umm, its more for curiosity sake that i ask that question.. Hope somebody can spend some of their time in explaning..
Thanks.
Explanation for ERROR 302:
Umm, how do I phrase the question...?
Ok.. The ERRORLEVEL line above merely suppress the error message but the error is still there. With the ERROR 302 still present, the code still work..
The source of the error is from "movwf LCD_TRIS".
Code:
SetPorts bsf STATUS, RP0 ;select bank 1
movlw 0x00 ;make all pins outputs
[B]movwf LCD_TRIS <<<---------- Source of error message[/B]
bcf STATUS, RP0 ;select bank 0
call Delay100 ;wait for LCD to settle
call LCD_Init ;setup LCD
My question is that what is Error 302 or rather, how can a working code contain Error messages...? Umm, its more for curiosity sake that i ask that question.. Hope somebody can spend some of their time in explaning..
Thanks.
Explanation for ERROR 302:
Code:
302 Register in operand not in bank 0. Ensure that bank bits are correct.
This is a commonly seen reminder message to tell you that a variable that is being accessed in not in bank 0. This message was added to remind you to check your code, particularly code in banks other than 0. Review the section on banksel (banksel - Generate Bank Selecting Code) and bankisel (bankisel - Generate Indirect Bank Selecting Code (PIC12/16 MCUs)) and ensure that your code uses bank bits whenever changing from ANY bank to ANY other bank (including bank 0).
Since the assembler or linker can't tell which path your code will take, you will always get this message for any variable not in bank 0. You can use the errorlevel command to turn this and other messages on and off, but be careful as you may not spot a banking problem with this message turned off. For more about errorlevel, see errorlevel - Set Message Level.
A similar message is 306 for paging.