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 support@ccsinfo.com

LCD trouble (dog-162 with 7036 driver)

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



Joined: 03 Oct 2008
Posts: 12
Location: Bogota

View user's profile Send private message

LCD trouble (dog-162 with 7036 driver)
PostPosted: Fri Apr 17, 2009 11:52 am     Reply with quote

Hello all,
I have a circuit that shows data in a lcd...some normal. I have been using a lcd that uses HD44780 driver and using the flex_lcd.c that I found around here. It works without problems using 4 data bits and 3 control bits But for design motives, I had to change the old Lcd to a new one, EA DOGM162S-A from Electronic Assembly that uses ST7036 driver. In over view, they are compatible, except that when I placed it in my circuit, it doesn't do anything. Like it would be turn off. so reading over I found that the driver are compatible but the init sequence. Because this new Lcd requires a contrast set before using it. I inserted the sequence over the flex_lcd library, based on the driver datasheet. But it still doesn't do anything. I have only one Lcd and I don't know if the Lcd is broken or if it's a hardware issue, or if the library is wrong.
Can anyone help me. Some ideas? Thanks in advance. Very Happy

I will put the two inits, the rest of the library is the same, but I have changed the init secuence.
The new:
Code:

//----------------------------
void lcd_init(void)
{
int8 i;

output_low(LCD_RS);

#ifdef USE_LCD_RW
output_low(LCD_RW);
#endif

output_low(LCD_E);

delay_ms(40);

lcd_send_nibble(0x30);   //function set
    delay_ms(5);         
lcd_send_nibble(0x30);   //function set     
    delay_us(50);   
lcd_send_nibble(0x30);   //function set 
    delay_us(50);
lcd_send_nibble(0x020);   //function set     
    delay_us(50);
lcd_send_nibble(0x29);   //function set   
    delay_us(50);                                                               
lcd_send_nibble(0x14);   //internal osc frecuency   
    delay_us(50);
lcd_send_nibble(0x70);   //Contrast set   
    delay_us(50); 
lcd_send_nibble(0x52);   //power/icon/contrast control   
    delay_us(50);
lcd_send_nibble(0x6a);   //follower control                       
    delay_us(50);         
lcd_send_nibble(0x0C);   //display on
    delay_us(50);                     
               
lcd_send_nibble(0x01);   //clear
    delay_ms(5);
lcd_send_nibble(0x06);   //entry mode set
    delay_us(50);       
/*lcd_send_nibble(0x33);
delay_ms(5);                     
lcd_send_nibble(0x32);*/           
/*
for(i=0; i < sizeof(LCD_INIT_STRING); i++)
   {
    lcd_send_byte(0, LCD_INIT_STRING[i]);        //delay_ms(5);
     
    // If the R/W signal is not used, then
    // the busy bit can't be polled.  One of
    // the init commands takes longer than
    // the hard-coded delay of 60 us, so in
    // that case, lets just do a 5 ms delay
    // after all four of them.
    #ifndef USE_LCD_RW
    delay_ms(5);
    #endif
   }  */

}

//----------------------------


The old:

Code:

//----------------------------
void lcd_init(void)
{
int8 i;

output_low(LCD_RS);

#ifdef USE_LCD_RW
output_low(LCD_RW);
#endif

output_low(LCD_E);

delay_ms(15);

for(i=0 ;i < 3; i++)
   {
    lcd_send_nibble(0x03);
    delay_ms(5);
   }

lcd_send_nibble(0x02);

for(i=0; i < sizeof(LCD_INIT_STRING); i++)
   {
    lcd_send_byte(0, LCD_INIT_STRING[i]);

    // If the R/W signal is not used, then
    // the busy bit can't be polled.  One of
    // the init commands takes longer than
    // the hard-coded delay of 60 us, so in
    // that case, lets just do a 5 ms delay
    // after all four of them.
    #ifndef USE_LCD_RW
    delay_ms(5);
    #endif
   }

}

//----------------------------


where,

Code:

int8 const LCD_INIT_STRING[4] =
{
 0x20 | (lcd_type << 2), // Func set: 4-bit, 2 lines, 5x8 dots
 0xc,                    // Display on
 1,                      // Clear display
 6                       // Increment cursor
 };

PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Apr 17, 2009 1:33 pm     Reply with quote

Look at the orginal code. The lcd_send_nibble() function sends the
lower 4 bits of a byte. So, the following code is sending '3'.
Quote:
for(i=0 ;i < 3; i++)
{
lcd_send_nibble(0x03);
delay_ms(5);
}


Here is your code. What are you sending ? You are sending the lower
4-bits of each byte, which is a '0'. You need to change the values below
to 0x03.
Quote:
lcd_send_nibble(0x30); //function set
delay_ms(5);
lcd_send_nibble(0x30); //function set
delay_us(50);
lcd_send_nibble(0x30); //function set
delay_us(50);

The change in delay times is OK. The data sheet for your LCD says so.


Now let's look at the rest of your code:
Quote:
lcd_send_nibble(0x020); //function set
delay_us(50);
lcd_send_nibble(0x29); //function set
delay_us(50);
lcd_send_nibble(0x14); //internal osc frecuency
delay_us(50);
etc.

And here's the original code:
Quote:
for(i=0; i < sizeof(LCD_INIT_STRING); i++)
{
lcd_send_byte(0, LCD_INIT_STRING[i]);

The original code is using the lcd_send_byte() function, but your code
is calling the nibble function. You need to change it so you're sending
bytes.
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