We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
Please remember to use the 'pre' and '/pre' tags around code, like is says in the instructions. Note that your code contains the sequence
DispDataWr(0x30); OS_Delay (2);
Thank you Walt Conley and Andy Neil . You are absolutely right. After I have changed the function DispDataWr from: static void DispDataWr(unsigned char val) to: static void DispDataWr(volatile unsigned char val), problems seem have been resolved. By the way the optimization setting I am using is level 8 ( reuse common entry code).