idea for my 8051 keypad lcd system

Status
Not open for further replies.

milad_omidi

Junior Member level 2
Joined
May 12, 2007
Messages
21
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,430
at89c51.h

I have a simple keypad and lcd system (8051based), in which every key
pressed is shown on lcd. now i must define a login system in which a user is admin and defines other users and passes and for every user abyte is sent to port 2.

any ideas or similar projects?
 

lcd keypad 8051

I will send the LCD KEybaord Routine use this for ur project . Remaing KEybaoard routine i ll send later.
U finish this lCD interface first and let me know

Added after 48 minutes:

#include <AT89c51.H> // Sfr defination header provided by keil in your case it may be #include <REG8252.H>
#include<intrins.h> // For defination of NOP function.

/*------------------------------------------------
LCD signals and data definations
------------------------------------------------*/

sfr LCDDATA = 0xA0; // P2 defined as LCD Data

sbit RS = 0XB4; // P3.4 as RS line of LCD
sbit RW = 0XB5; // P3.5 as R/W line of LCD
sbit EN = 0XB6; // P3.5 as EN line of LCD
void waitLCD(void)
{
unsigned char a, ACC;
for(a=0;a<255;a++)
{
EN = 0;
RS = 0;
RW = 1;
LCDDATA = 0Xff;
_nop_();
_nop_();
EN = 1;
ACC = LCDDATA;
ACC = ACC & 0X80;
if(ACC==0)
break;
}
EN = 0;
RW = 0;
}

void ClearDisplay()
{
EN = 1;
RS = 0;
LCDDATA = 0X01;
EN = 0;
waitLCD();
}

void WriteLCDCmd(char c)//reentrant
{
EN = 1;
RS = 0;
LCDDATA = c;
EN = 0;
waitLCD();
}

void WriteLCDData(char c, char Pos)
{
if(Pos < 16)
WriteLCDCmd(Pos | 0x80);
else
WriteLCDCmd((Pos-16) | 0xC0);
EN = 1;
RS = 1;
LCDDATA = c;
EN = 0;
waitLCD();
}

/*------------------------------------------------
LCD Commands Table
--------------------------------------------------
1 Clear display screen
2 Return Home
4 Decrement cursor (Shift cursor to left)
6 Increment cursor (Shift cursor to right)
5 Shift display right
7 Shift display left
8 Display off, cursor off
A Display off, cursor on
C Display on, cursor off
E Display on, cursor blinking
F Display on, cursor blinking
10 Shift cursor position to left
14 Shift cursor position to right
18 Shift the entire display to the left
1C Shift the entire display to the right
80 Force cursor position to beginning of 1st line
C0 Force cursor position to beginning of 2nd line
38 2 lines and 5X7 matrix.*/

void Initialize_LCD()
{
unsigned char i;

i = 0X38; // For 8 bit communication and 16X2 type.
WriteLCDCmd(i);

i = 0X0E; // For turning LCD ON and set cursor position.
WriteLCDCmd(i);

i = 0X06; // For incrementing cursor position automatically.
WriteLCDCmd(i);

i = 0X0C; // For Cursor off.
WriteLCDCmd(i);


void main()
{
unsigned char i = 0, My_name[] = "RAVI", prog[] = "LCD Interface" ;
unsigned int x = 0;
Initialize_LCD(); // Initialise the LCD display.
ClearDisplay(); // Clear LCD display.
for(i = 0; i < 28; i++)
WriteLCDData(prog,i); // Write Name on LCD
for(x=0 ; x<30000; x++); // simple delay of 1 sec for 12 Mhz crystal.
ClearDisplay(); // Clear LCD display.
for(i = 0; i < 6; i++)
WriteLCDData(My_name,i); // Write Name on LCD
while(1); // Infinite loop
}
 
mcs51 keypad

@milad_omidi
now i must define a login system in which a user is admin and defines other users and passes and for every user abyte is sent to port 2
can u explain it a little bit???
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…