This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

non-executable code (invalid break points)

The following codes are for initializing the LCD display and directly copied from my program, but when those codes under debugging using software simulator, why the line 6 & line 12 always are non-executable code (invalid break points)? What are the possible reasons?

void DispInit ( unsigned char maxrows, unsigned char maxcols)
{
1. DispInitPort();
2. DispMaxRows = maxrows;
3. DispMaxCols = maxcols;
4. OS_Delay(100);
5. DispSel(DISP_SEL_CMD_REG);
6. DispDataWr(0x30);
7. OS_Delay (2);

8. DispSel(DISP_SEL_CMD_REG);
9. DispDataWr(0x30);
10. OS_Delay(150);


11. DispSel(DISP_SEL_CMD_REG);
12. DispDataWr(0x30);
13. OS_Delay(2);
14. DispSel(DISP_SEL_CMD_REG);
15. DispDataWr(0x08);
16. OS_Delay(2);
17. DispSel(DISP_SEL_CMD_REG);
18. DispDataWr(0x08);
19. OS_Delay(2);
}

Please help me, it is time consuming & really killing

Parents
  • I've never used LCDs so this may be dumb question. Is DispDataWr() an actual function call or a macro that writes data to a variable? If it is a macro you might be able to fix the problem by declaring the variable as volatile so it is not obtimized out.

    -Walt

Reply
  • I've never used LCDs so this may be dumb question. Is DispDataWr() an actual function call or a macro that writes data to a variable? If it is a macro you might be able to fix the problem by declaring the variable as volatile so it is not obtimized out.

    -Walt

Children
  • Thank you for your responds.

    The following codes is the DispDataWr() function:

    static void DispDataWr(unsigned char val) {

    P21_PIN = 0; // write operation
    P22_PIN = 1; // give operation start signal
    _nop_ ();
    _nop_ (); // wait
    P1 = val; // write value
    P22_PIN = 0;
    P1 = 0xff; // DATA_PORT is input [prevent I/O-Port from demage]
    }

    and the OS_Delay function is the following codes:

    void OS_Delay ( int n )
    {
    int i;

    while( n --)
    {
    for(i == 0; i < 125; i++ )
    {;}
    }
    }