| Details |
Message |
|
Read-Only
Author pavi k
Posted 20-Apr-2009 11:43 GMT
Toolset C51
|
 LCD display Code
pavi k
#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?
|
|
|
Read-Only
Author Tamir Michael
Posted 20-Apr-2009 12:02 GMT
Toolset C51
|
 RE: LCD display Code
Tamir Michael
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.
|
|
|
Read-Only
Author pavi k
Posted 20-Apr-2009 12:59 GMT
Toolset C51
|
 RE: LCD display Code
pavi k
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...
|
|
|
Read-Only
Author Tamir Michael
Posted 20-Apr-2009 13:09 GMT
Toolset C51
|
 RE: LCD display Code
Tamir Michael
well, paki, this is just fantastic. how about the MODEL of the
display? do you evnn have a data sheet?
|
|
|
Read-Only
Author erik malund
Posted 20-Apr-2009 15:01 GMT
Toolset C51
|
 first post
erik malund
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
|
|
|
Read-Only
Author Tamir Michael
Posted 20-Apr-2009 16:19 GMT
Toolset C51
|
 RE: first post
Tamir Michael
weapons on target, erik!
|
|
|
Read-Only
Author Andy Neil
Posted 20-Apr-2009 14:08 GMT
Toolset C51
|
 RE: i dont know where is the problem?
Andy Neil
So what have you done in order to find out?
See here for some tips:
Scientific approach to debugging:
http://www.8052.com/forum/read/118587
http://www.8052.com/faqs/120313
Also look at this thread: http://www.keil.com/forum/docs/thread14627.asp
and search it for "debugging"...
|
|
|
Read-Only
Author erik malund
Posted 20-Apr-2009 19:02 GMT
Toolset C51
|
 one more tip
erik malund
READ the datasheet for the LCD
Erik
|
|