Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/11/03 08:24
Read: times


 
#58265 - Problem with writing on LCD
Hello!
I have written the following program in C51 (keil uvision2), for writing data on LCD module, the LCD module has been connected as memory mapped i/o device(through "latch 74573" with port 0),the address for writing commands is 0x0000 and for data is 0x0001,
now the problem is that this program is not giving the required result, so please help me to correct this program.

thanks in advance
/******************************************************
Program written for LCD on SBC51.
Written by: Muhammad Kareem, University of Peshawar.
*****************************************************************************/
#include <reg51.h>
#include <stdio.h>

unsigned char xdata lcd_command _at_ 0x0000;
unsigned char xdata lcd_data _at_ 0x0001;
unsigned int i,j,k;

void delay(unsigned int k);
void InitLCD(void);
void WriteData( unsigned char value );
void WriteCommand( unsigned char value );
void WriteLCD( unsigned char* message );
void CursorHome();

void main(void)
{
delay(300);
while(1)
{

InitLCD();
CursorHome();
WriteLCD( "DEPARTMENT OF ELECTRONICS" );
WriteData( 'x' );
WriteData( 'y' );
WriteData( 'z' );
}
}
void delay(unsigned int k)
{
for(i=0;i<k;i++)
for(j=0;j<100;j++);
}
void InitLCD(void)
{
WriteCommand(0x06);
WriteCommand(0x38);
WriteCommand(0x0f);
WriteCommand(0x01);
WriteCommand(0x02);
}
void WriteData( unsigned char value )
{
lcd_data = value ;
delay(300);
}
void WriteCommand( unsigned char value )
{
lcd_command = value ;
delay(300);
}
void WriteLCD( unsigned char* message )
{
unsigned char m;

for( m=0; m<20; m++ )
{
if( !message[m] )
break;

WriteData(message[m]);
}
}
void CursorHome()
{
WriteCommand(0x02);
delay(300);
}







List of 8 messages in thread
TopicAuthorDate
Problem with writing on LCD            01/01/70 00:00      
   RE: Problem with writing on LCD            01/01/70 00:00      
      RE: Problem with writing on LCD            01/01/70 00:00      
         RE: Problem with writing on LCD            01/01/70 00:00      
            RE: Problem with writing on LCD            01/01/70 00:00      
               RE: Problem with writing on LCD            01/01/70 00:00      
                  RE: Problem with writing on LCD            01/01/70 00:00      
                     RE: Problem with writing on LCD            01/01/70 00:00      

Back to Subject List