#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?
how on earth can somebody help you?! we don't even know the type of display, and you did not say anything but "it does not work". great.
it's 4x20 LCD display.... This program is to display char 'a' in LCD 0x8005 address has the following details : -----RS (Regiter Select) -----R/W (Read/Write Enable Pin) -----EA (Enable Pin) -----TP1 -----TP2 -----TP3 -----TP4 -----TP5 TP1 to TP5 for LCD display ...as per my requirment this should be high always.... 0x8006 address contains the following details ---- DB0 -----DB1 ---- DB2 -----DB3 ---- DB4 -----DB5 ---- DB6 -----DB7 in 0x8006 address i wil write the data...
well, paki, this is just fantastic. how about the MODEL of the display? do you evnn have a data sheet?
So what have you done in order to find out?
See here for some tips:
Scientific approach to debugging: www.8052.com/.../118587
www.8052.com/.../120313
Also look at this thread: http://www.keil.com/forum/docs/thread14627.asp and search it for "debugging"...
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
weapons on target, erik!
READ the datasheet for the LCD