Shop OBEX P1 Docs P2 Docs Learn Events
programming for lcd display — Parallax Forums

programming for lcd display

edited 2012-07-19 07:09 in Accessories
i have written some code for transmitting text from at89c52 to lcd display. input to the microcontroller is from P3.0(RXD).

executed the program and tested with proteus simulator. i am able transmit the text. but after 16 letters, text is not displaying.
if we keep on giving input, it is giving the letters but some words are missing in between...
i am attaching the image. plz help me out....'
clip_image002.jpg
..
clip_image002.jpg


my code is
#include <REGX52.H>

//Program to interface RFID with 8051 microcontroller (AT89C51) #include<reg51.h>
unsigned int data_out,command=0x80,temp;
sfr lcd_data_pin=0x90; //P1 port
sbit rs=P2^0; //Register select
sbit rw=P2^1; //Read/Write
sbit en=P2^2; //Enable pin
unsigned char card_id[16];

void delay(unsigned int count) //Function to provide delay
{
int i,j;
for(i=0;i<count;i++)
for(j=0;j<1275;j++);
}

void lcd_command(unsigned char comm) //Lcd command funtion
{
lcd_data_pin=comm;
en=1;
rs=0;
rw=0;
delay(1);
en=0;
}

void lcd_data(unsigned char disp) //Lcd data function
{
lcd_data_pin=disp;
en=1;
rs=1;
rw=0;
delay(1);
en=0;
}

lcd_string(unsigned char *disp) //Function to send string
{
int x;
for(x=0;disp[x]!=0;x++)
{
lcd_data(disp[x]);
}
}
void lcd_ini() //Function to initialize the LCD
{
lcd_command(0x38);
delay(5);
lcd_command(0x0F);
delay(5);
lcd_command(0x80);
delay(5);
}

void recieve() //Function to recieve data serialy from RS232
{
unsigned char k;
for(k=0;k<16;k++)
{
while(RI==0);
card_id[k]=SBUF;
RI=0;
}
}

void main()
{
int i;
TMOD=0x20; //Enable Timer 1
TH1=0XFD;
SCON=0x50;
TR1=1; // Triggering Timer 1
lcd_ini();
//lcd_command(0x80); //Place cursor to second position of first line
delay(1);
while(1)
{

recieve();
for(i=0;i<32;i++)
{
lcd_data(card_id);
}
}
}
624 x 468 - 59K

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-19 07:09
    These forums provide support for products made or sold by Parallax, mostly the Propeller and Basic Stamp microcontrollers. We can't help you with your 8051 programming problems. Sorry.
Sign In or Register to comment.