This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LCD display Code

#define LCD_CNTL 0x8005
#define LCD_DATA 0x8006

/*LCD_CNTL Contains :RS,R/w,EA;
  LCD_DATA ---------:DA0 ,DA1,DA2,DA3,DA4,DA5,DA6,DA7;
*/
#define CLEAR_DISPLAY 0x01   // Clear entire display and set Display Data Address to 0
#define DD_RAM_PTR    0x80   // Address Display DataRAM pointer
#define DISP_INIT     0x38   // 8 bit 2 lines
#define INC_MODE      0x06   // Display Data RAM pointer incremented after write
#define LCD_ON            0x0C


#include <REG54.H>
#include <intrins.h>
#include <lcd.h>
#include <absacc.h>
 void wait(unsigned int time)
  {
  int i;
    for (i = 0; i < time ;i++){
        }
}
static void LCD_Write (unsigned char val)
  {

   XBYTE[LCD_DATA]= val;
    wait (100);
         XBYTE[LCD_CNTL]=0xFC;
    wait (100);
   XBYTE[LCD_CNTL]=0xF8;
    wait (100);
 }

static void WriteDataReg (unsigned char val)
{

  XBYTE[LCD_DATA]= val;
     wait (100);
  XBYTE[LCD_CNTL]=0xFD;
     wait (100);
  XBYTE[LCD_CNTL]=0xF9;
   wait (100);
  /*XBYTE[LCD_DATA]= 0xff;
   wait (100); */

}
char putchar (char c)
{
        WriteDataReg (c);
   return (c);
}
void lcd_init(void)
{

LCD_Write(0x38); // LCD 16x2, 5x7, 8bits data
LCD_Write(0x01); // Clear LCD display
LCD_Write(0x06); // Window fixed
LCD_Write(0x80); // Window fixed
}


void main (void)
{
 lcd_init();
 putchar ('a');
 while (1);
}

i have enclosed code for LCD display ....i am not getting the o/p...i dont know where is the problem?

Parents
  • first post, second post
    LCD_Write(0x38); // LCD 16x2, 5x7, 8bits data
    second post
    it's 4x20 LCD display....

    I guess we have one of these, all too frequent cases, where someone copies some code from the net and do not even TRY to get the basics of understanding.

    Erik

Reply
  • first post, second post
    LCD_Write(0x38); // LCD 16x2, 5x7, 8bits data
    second post
    it's 4x20 LCD display....

    I guess we have one of these, all too frequent cases, where someone copies some code from the net and do not even TRY to get the basics of understanding.

    Erik

Children