![mplab xc8 mplab xc8](https://i58.servimg.com/u/f58/11/80/59/89/proper10.png)
![mplab xc8 mplab xc8](https://i0.wp.com/www.dudigan.com/wp-content/uploads/2018/06/asd.png)
Also note that when repositioning the cursor delays are also required.
#Mplab xc8 code
In your code you seem to be missing the delay after clearing the display. A delay of 100us compared to 100ms can make a huge difference in terms of getting the LCD to display correctly. Use the delay routines and verify they work correctly.ī) Carefully read and re-read your LCD datasheet.
![mplab xc8 mplab xc8](https://i.ytimg.com/vi/-1ylPJKBjX8/maxresdefault.jpg)
To debug this problem you may want to try the following.Ī) Create a simple program to flash an LED light and verify that the frequency of the light flashing is the same. I would be more suspect that your delay timings for the LCD screen are causing you the issues your seeing however. The screenshot you have provided of the configuration bits shows a variance.Ĭonfig 4 Bit 2 which is the Low Voltage ICSP Enable bit is disabled on the MicroC Screenshot? #pragma config EBTRB = OFF // Boot Block Table Read Protection bit (Boot Block (000000-0001FFh) not protected from Table Reads executed in other blocks)Ĭonfig bits seen by PICkit2 from hex files compiled my MPLAB and MikroC are #pragma config EBTR3 = OFF // Table Read Protection bit (Block 3 (006000-007FFFh) not protected from Table Reads executed in other blocks)
![mplab xc8 mplab xc8](https://mclr.1v0.net/wp-content/uploads/2016/06/mplab-xc8-compiler.png)
#pragma config EBTR2 = OFF // Table Read Protection bit (Block 2 (004000-005FFFh) not protected from Table Reads executed in other blocks) #pragma config EBTR1 = OFF // Table Read Protection bit (Block 1 (002000-003FFFh) not protected from Table Reads executed in other blocks) #pragma config EBTR0 = OFF // Table Read Protection bit (Block 0 (000200-001FFFh) not protected from Table Reads executed in other blocks) #pragma config WRTD = OFF // Data EEPROM Write Protection bit (Data EEPROM not write protected) #pragma config WRTB = OFF // Boot Block Write Protection bit (Boot Block (000000-0001FFh) not write protected) #pragma config WRTC = OFF // Configuration Register Write Protection bit (Configuration registers (300000-3000FFh) not write protected) #pragma config WRT3 = OFF // Write Protection bit (Block 3 (006000-007FFFh) not write protected) #pragma config WRT2 = OFF // Write Protection bit (Block 2 (004000-005FFFh) not write protected) #pragma config WRT1 = OFF // Write Protection bit (Block 1 (002000-003FFFh) not write protected) #pragma config WRT0 = OFF // Write Protection bit (Block 0 (000200-001FFFh) not write protected) #pragma config CPD = OFF // Data EEPROM Code Protection bit (Data EEPROM not code protected) #pragma config CPB = OFF // Boot Block Code Protection bit (Boot Block (000000-0001FFh) not code protected) #pragma config CP3 = OFF // Code Protection bit (Block 3 (006000-007FFFh) not code protected) #pragma config CP2 = OFF // Code Protection bit (Block 2 (004000-005FFFh) not code protected) #pragma config CP1 = OFF // Code Protection bit (Block 1 (002000-003FFFh) not code protected) #pragma config CP0 = OFF // Code Protection bit (Block 0 (000200-001FFFh) not code protected) #pragma config LVP = ON // Low Voltage ICSP Enable bit (Low Voltage ICSP enabled) #pragma config STVR = ON // Stack Full/Underflow Reset Enable bit (Stack Full/Underflow will cause RESET) #pragma config CCP2MUX = ON // CCP2 Mux bit (CCP2 input/output is multiplexed with RC1) #pragma config WDTPS = 128 // Watchdog Timer Postscale Select bits (1:128) #pragma config WDT = OFF // Watchdog Timer Enable bit (WDT disabled (control is placed on the SWDTEN bit)) #pragma config BORV = 20 // Brown-out Reset Voltage bits (VBOR set to 2.0V) #pragma config BOR = ON // Brown-out Reset Enable bit (Brown-out Reset enabled) #pragma config PWRT = OFF // Power-up Timer Enable bit (PWRT disabled) #pragma config OSCS = OFF // Oscillator System Clock Switch Enable bit (Oscillator system clock switch option is disabled (main oscillator is source)) #pragma config OSC = HS // Oscillator Selection bits (HS oscillator) Where does the difference lay? I suspect it has something to do with delay speed or so.Ĭode for main is as follows because its the thing that i change #include I am confused that configuration bits are as same for both MPLAB and MikroC. To my surprise, the Proteus as well as hardware worked as a charm. Then I ported the same code in MikroC - only made a slight change of replacing _delay_us and _delay_ms with available delay routines in MikroC. However, when I burned the program, the controller hardware refused to display anything. I tested it in ISIS and it showed perfect output. I found a library and worked on it and MPLAB XC8 compiled it successfully. I have been trying to write a program for LCD on PIC18f452.