This is the final code I compiled- though it compiled successfully, I was getting a warning( marked in red). Will this be a problem ?
//CONFIGURATIONS
#pragma config FOSC = HSPLL_HS // Using 20 MHz crystal with PLL
#pragma config PLLDIV = 5 // Divide by 5 to provide the 96 MHz PLL with 4 MHz input
#pragma config CPUDIV = OSC1_PLL2 // Divide 96 MHz PLL output by 2 to get 48 MHz system clock
#pragma config USBDIV = 2 // USB clock comes from 96 MHz PLL output / 2
#pragma config FCMEN = OFF // Disable Fail-Safe Clock Monitor
#pragma config IESO = OFF // Disable Oscillator Switchover mode
#pragma config PWRT = OFF // Disable Power-up timer
#pragma config BOR = OFF // Disable Brown-out reset
#pragma config VREGEN = ON // Use internal USB 3.3V voltage regulator
#pragma config WDT = OFF // Disable Watchdog timer
#pragma config MCLRE = ON // Enable MCLR Enable
#pragma config LVP = OFF // Disable low voltage ICSP
#pragma config ICPRT = OFF // Disable dedicated programming port (44-pin devices)
#pragma config CP0 = OFF // Disable code protection
// CONFIG7H
#define RS PORTAbits.RA0 /* PORT for RS */
#define E PORTAbits.RA2 /* PORT for E */
#define lcd_data PORTD
#include "p18f4550.h"
//Function Prototype
void delay (unsigned long i);
void E_clock(void);
void lcd_bus(unsigned char data);
void lcd_init(void);
void lcd_char(unsigned char character);
void lcd_goto(unsigned char address);
void lcd_string(unsigned char *s);
void ldelay(unsigned int itimes);
// main program start here
void main (void)
{
TRISA= 0b11111010;
TRISD= 0b00000000;
// PORTD= 0b00000000;
ldelay(250);
///////////////////////////////////Starting LCD initialization///////////////
lcd_bus(0b00111000); //0x38, 8 bits interface, 2 line display
ldelay(250);
lcd_bus(0b00001110); //0x0E, Display ON, curssor ON
ldelay(15);
lcd_bus(0b00000001); //0x01, clear LCD
lcd_bus(0b00000110); //0x06, Increase cursor after each character
ldelay(15);
lcd_bus(0b10000001); //line 1 position 1,hex 81
ldelay(15);
/////////////////////////////You may put the above code in a function also////////////
lcd_string("Welcome"); ---->LCD code.c:58:Warning [2054] suspicious pointer conversion
//lcd_goto(0x40); //jump to 2nd line
//lcd_string("Good morning");
while(1)continue;//
}
void delay(unsigned long i)
{
for (i=i; i>0; i--);
}
void E_clock(void) //// to strobe the enable pin
{
E=1;
ldelay(1);
E=0;
ldelay(1);
}
void lcd_bus(unsigned char data)
{
lcd_data= data;
RS=0;
E_clock();
}
void lcd_init(void)
{
RS= 0;
delay(200);
lcd_bus(0b00111000); //0x38, 8 bits interface, 2 line display
lcd_bus(0b00000001); //0x01, clear LCD
lcd_bus(0b00000010); //0x02, Home position
lcd_bus(0b00001111); //0x0F, Display ON, curssor ON, Cursor Blink
lcd_bus(0b00000110); //0x06, Increase cursor after each character
}
void lcd_char(unsigned char character)
{
RS= 1;
delay(200);
lcd_bus(character);
}
void lcd_goto(unsigned char address)
{
RS=0;
delay(200);
lcd_bus(0x80+address);
}
void lcd_string(unsigned char *s)
{
while(*s)
lcd_char(*s++);
}
void ldelay(unsigned int itimes){
unsigned int i; unsigned int j;
for(i=0;i<itimes;i++)
for(j=0;j<165;j++);
}
for the pins RS and E, when I used RA0 and RA2 instead of RC4 and RC5, I got the following output ( just the cursor at random places) . I didnt obtain any outputs when using pins RC4 and RC5.