/* Main.c file generated by New Project wizard * * Created: Fri Feb 21 2014 * Processor: PIC18F4520 * Compiler: MPLAB C18 */#include <p18f4520.h>#include <stdlib.h> #include <delays.h> #include <string.h>/****************PIN DETAILS****************/#define LCD_data PORTC // LCD Data port#define LCD_C7 PORTCbits.RC7 // LCD C7/Busy Flag#define LCD_rs PORTDbits.RD0 // LCD Register Select#define LCD_en PORTDbits.RD1 // LCD Enable#define LCD_rw PORTDbits.RD2 // LCD Read/Write/*******************************************//******************FUNCTION PROTOTYPE*******************/void LCD_init(void);void LCD_busy(void);void LCD_command(unsignedchar var);void LCD_senddata(unsignedchar var);void LCD_sendstring(unsignedchar*var);/*******************************************/void main(){
TRISC =0x00;
LATC =0x00;
TRISD =0x00;
LATD =0x00;
LCD_init();//LCD_senddata('W');//Delay10KTCYx (25);
LCD_sendstring("LCD Tutorial");//Delay10KTCYx (25);}/******************FUNCTION PROTOTYPE*******************//* Initialization by internal Reset Circuit */void LCD_init(){
LCD_data =0x38;//Function set: 2 Line, 8-bit, 5x7 dots
LCD_rs =0;//Selected command register
LCD_rw =0;//We are writing in data register
LCD_en =1;//Enable H->L
LCD_en =0;
LCD_busy();//Wait for LCD to process the command
LCD_data =0x0F;//Display on, Curser blinking command
LCD_rs =0;//Selected command register
LCD_rw =0;//We are writing in data register
LCD_en =1;//Enable H->L
LCD_en =0;
LCD_busy();//Wait for LCD to process the command
LCD_data =0x01;//Clear LCD
LCD_rs =0;//Selected command register
LCD_rw =0;//We are writing in data register
LCD_en =1;//Enable H->L
LCD_en =0;
LCD_busy();//Wait for LCD to process the command
LCD_data =0x06;//Entry mode, auto increment with no shift
LCD_rs =0;//Selected command register
LCD_rw =0;//We are writing in data register
LCD_en =1;//Enable H->L
LCD_busy();}/* Steps to read busy flag */void LCD_busy(){
LCD_C7 =1;//Make C7th bit of LCD as i/p
LCD_en =1;//Make port pin as o/p
LCD_rs =0;//Selected command register
LCD_rw =1;//We are readingwhile(LCD_C7 >0){//read busy flag again and again till it becomes 0
LCD_en =0;//Enable H->L
LCD_en =1;}}/* Sending Commands to LCD */void LCD_command(unsignedchar var){
LCD_data = var;//Function set: 2 Line, 8-bit, 5x7 dots
LCD_rs =0;//Selected command register
LCD_rw =0;//We are writing in instruction register
LCD_en =1;//Enable H->L
LCD_en =0;
LCD_busy();//Wait for LCD to process the command }// Using the above function is really simple // var will carry the command for LCD // e.g. // // LCD_command(0x01);/* Setting cursor position on LCD *//*LCD_command(0x83);*//* Sending Data to LCD */void LCD_senddata(unsignedchar var){
LCD_data = var;//Function set: 2 Line, 8-bit, 5x7 dots
LCD_rs =1;//Selected data register
LCD_rw =0;//We are writing
LCD_en =1;//Enable H->L
LCD_en =0;
LCD_busy();//Wait for LCD to process the command }// Using the above function // we will pass the character to display as argument to function // e.g. // // LCD_senddata('A');/* if we have a string to send to LCD? */void LCD_sendstring(unsignedchar*var){while(*var){//till string ends
LCD_senddata(*var);//send characters one by one
var++;}}// Using the above function// we will pass the string directly to the function // e.g. // // LCD_sendstring("LCD Tutorial");/*******************************************/
Please suggest me something to solve this warning issue 8-O