Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PrintLCD command for the LCD

Status
Not open for further replies.

Rizwanishaq

Junior Member level 3
Joined
Sep 26, 2006
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Pakistan
Activity points
1,583
I have given all the files now add to the library and give me the response is it good or not
you only need to add header file LCD.h that is at the end of the code
then u can use LCDinitialize(),Clearlcd(),and the printLCD(buff);
//////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////This is provided by the Rizwan Ishaq///////////////
///////////////////// Comsats IIT Wah Campus Pakistan /////////////////////
///////////////////////////// Computer Engineer ///////////////////
/////////////////////////////////////////////////////////////////////////////////////
//This code print the character on the LCD module
//You can use this code to your code without any detail of the LCD
//
#include "LCD.h"
void main()
{
Lcdinitialize(); //Initialize the LCD
Clearlcd(); //Clear the LCD
printLCD("AaBbCc"); // printLCD(buff)
while(1);

}
//////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////
#include "LCD.h"
/////////////////////////////////////////////////////////////////////
//////////////////////////Write command routine//////////////////////
void wrcmd(unsigned char cbyte)
{
P1_6=0; //RW
P1_5=0; //RS
P0=cbyte;
P1_7=0; //EN
P1_7=1; //EN
delay();
}
/////////////////////////////////////////////////////////////////////
////////////////////////Write character routine//////////////////////
void wrchar(unsigned char dbyte)
{
P1_6=0; //RW
P1_5=1; //RS
P0=dbyte;
P1_7=1; //EN
P1_7=0; //EN
delay();
}
/////////////////////////////////////////////////////////////////////
////////////////////////Lcd initialization routine///////////////////
void Lcdinitialize()
{

wrcmd(0x38); //Function set (8-bit interface, 2 lines, 5*7 Pixels)
wrcmd(0x10); //Move cursor one character left
wrcmd(0x06); //Character Entery mode
wrcmd(0x0F); //Turn on visible blinking-block cursor
wrcmd(0x03); //Display and cursor
}
/////////////////////////////////////////////////////////////////////
//////////////////////////////Clear LCD routine//////////////////////
void Clearlcd()
{
wrcmd(0x01); //Clear Screen
}
/////////////////////////////////////////////////////////////////////
////////////////////////////////Delay routine////////////////////////
void delay()
{
int i;
for(i=0;i<=5000;i++)
{;}
}
/////////////////////////////////////////////////////////////////////
//////////////////////////PrintLCD Routine///////////////////////////
printLCD(unsigned char *buff)
{
while(*buff)
{
wrchar(*buff);
buff++;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////Header file LCD.h//////////////////////////////////////
#include <at89x51.h>
#include<math.h>
#include<stdio.h>
void wrcmd(unsigned char cbyte);
void wrchar(unsigned char dbyte);
printLCD(unsigned char *buff);
void Lcdinitialize();
void Clearlcd();
void delay();
////////////////////////////////////////////////////////////////////////////////////////
 

hi


6_1166369134.JPG
 

wonderfull , thank u
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top