CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Need help with lcd controller

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
TomB



Joined: 14 Apr 2004
Posts: 4

View user's profile Send private message

Need help with lcd controller
PostPosted: Wed Apr 14, 2004 11:47 pm     Reply with quote

Hi,

I´ve got some trouble with a lcd. ( controller is hd44780) My pinout is as following :

PIC18F258

PIN A2 : LCD RS
PIN A4 : LCD RW
PIN A5 : LCD Enable

PIN C4 - C7 : LCD Data DB4 - DB7

my code doesn´t work ! can anybody help me, please ?!

#define LCD_RS PIN_A2
#define LCD_RW PIN_A4
#define LCD_E PIN_A5

#bit LCD_E_BIT = 0xF80.5
#bit LCD_RS_BIT = 0xF80.2
#bit LCD_RW_BIT = 0xF80.4

#byte LCD_DATA = PORTC


void LCD_Init(void);
void PUT_LCD_CMD(char Display_Data);
void ENABLE_LCD(void);
void Check_BF(void);


//*****************************************************************************
void LCD_Init(void)
{
// POWER ON
delay_ms(15);
LCD_RS_BIT = 0;
LCD_RW_BIT = 0;
LCD_DATA = (0b00110000);
ENABLE_LCD();
LCD_DATA = (0b00110000);
ENABLE_LCD();
LCD_DATA = (0b00110000);
ENABLE_LCD();


// Function set 4-bit Interface
LCD_RS_BIT = 0;
LCD_RW_BIT = 0;
LCD_DATA = (0b00100000);
ENABLE_LCD();


// Function set 4-bit Datenlaenge, 2-zeiliges Display, 5x7 Font
// N = 1 --> 2-line-display
// F = 0 --> 5x7 dot character font
// LCD_DATA = (0b0010NF**)
LCD_RS_BIT = 0;
LCD_RW_BIT = 0;
Display_Data = 0x28;
PUT_LCD_CMD(Display_Data);


// Display ON/OFF
// Display ein, Cursor ein, Cursor blinken
LCD_RS_BIT = 0;
LCD_RW_BIT = 0;
Display_Data = 0x0F;
PUT_LCD_CMD(Display_Data);


// Display clear
LCD_RS_BIT = 0;
LCD_RW_BIT = 0;
Display_Data = (0x01);
PUT_LCD_CMD(Display_Data);


// entry mode set
// I/D = 1 --> Increment
// S = 0 --> No Shift
// LCD_DATA = (0b0.0.0.0.0.1.I/D.S);
LCD_RS_BIT = 0;
LCD_RW_BIT = 0;
Display_Data = (0x06);
PUT_LCD_CMD(Display_Data);


}

//*****************************************************************************
void PUT_LCD_CMD(char Display_Data)
{
LCD_DATA = Display_Data;
ENABLE_LCD();
LCD_DATA = Display_Data << 4;
ENABLE_LCD();
}

//*****************************************************************************
void ENABLE_LCD(void)
{
LCD_E_BIT = 1;
delay_us(10);
LCD_E_BIT = 0;
delay_ms(5);
}
Hans
Guest







LCD help
PostPosted: Thu Apr 15, 2004 1:42 am     Reply with quote

Are you using a pullup resistor on A4 as this is an open drain output??

Hans
TomB



Joined: 14 Apr 2004
Posts: 4

View user's profile Send private message

Re: LCD help
PostPosted: Thu Apr 15, 2004 6:27 am     Reply with quote

Hans wrote:
Are you using a pullup resistor on A4 as this is an open drain output??

Hans


I´ve found the problem ! It was the contrast setting of the DOT LCD !!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group