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

Flexible LCD driver
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
PCM programmer



Joined: 06 Sep 2003
Posts: 20317

View user's profile Send private message

PostPosted: Wed Dec 20, 2006 12:55 am     Reply with quote

There's more information on the Seiko L2432 LCD in this manual:
http://www.iweil.com/devices/lcd%20drivers/seiko%20manual.pdf
It shows that the controller is compatible and that the address of
line 2 is 0x40. This means it should work OK with the flex_lcd.c
driver that's posted at the beginning of this thread.
jaime



Joined: 25 Nov 2005
Posts: 56
Location: Porto - Portugal

View user's profile Send private message Visit poster's website

PostPosted: Thu Dec 21, 2006 8:43 am     Reply with quote

OK

it works. I try with 16x2 (LM16L) and 24x2 (L2432).

Thanks
Silver_Reaper



Joined: 30 Jan 2007
Posts: 1

View user's profile Send private message

Extenal Interrupt vs LCD
PostPosted: Tue Jan 30, 2007 6:12 pm     Reply with quote

Hi, Im using a 18F252,16x2 line LCD and my compiler version is 3.170 (very old). I want to use the external interrupt pin (PIN_B0) on this PIC.

With the normal LCD.c driver this is not possible even when I changed the pins as follows:

Code:

struct lcd_pin_map {                 // This structure is overlayed
           BOOLEAN unused;           // on to an I/O port to gain
           BOOLEAN enable;           // access to the LCD pins.
           BOOLEAN unuse;            // The bits are allocated from
           BOOLEAN rs;               // low order up.  ENABLE will
           int     data : 4;         // be pin B0.
        } lcd;


I also tried the flex_lcd.c driver, but this also did not work for me. It is as if the LCD driver (both) still takes control over the RB_0 PIN of the PIC.

The code for the external interrupt works, I've tested it with a blinking LED and without the LCD and LCD code.

I want to use:

PIN_B1 -> Enable
PIN_B3 -> RS
PIN_B4 - PIN_B7 -> Data
R/W is connected to ground.

I've also tested the LCD on its own, and it also works fine with the normal LCD.c driver. Even with enable on PIN_B1. But the external interrupt PIN_B0 does not function correctly.

Any help would be appreciated. Thanks.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Tue Jan 30, 2007 6:36 pm     Reply with quote

You have to make sure that you setup the external interrupt as well as make sure the tris is set correctly.
PCM programmer



Joined: 06 Sep 2003
Posts: 20317

View user's profile Send private message

PostPosted: Tue Jan 30, 2007 6:45 pm     Reply with quote

Start a new thread in the main forum and post a small but complete
test program that shows the problem.
domdom



Joined: 06 Sep 2006
Posts: 29

View user's profile Send private message

PostPosted: Sun Feb 25, 2007 1:36 am     Reply with quote

how to verify whether the LCD is damaged or not?
LCD 2x16

currently doing LCD display with DS1307 and EEPROM 24AA512(ignore eeprom parts)

I not manage to get thing display on my LCD. I suspect my LCD is damaged.

here is my code
Code:

#include "lcdtest.c"

#define    LCD_RS      PIN_D0
#define    LCD_RW      PIN_D1
#define    LCD_E      PIN_D2

int8 lcd_read_byte()
{
   int8 retval;
   output_high(LCD_RW);
   output_high(LCD_E);
   retval = input_d();
   output_low(LCD_E);
   output_low(LCD_RW);
   return(retval);
}

void lcd_send_byte(int8 data)
{
   while(bit_test(lcd_read_byte(),7));
   output_high(LCD_RS);
   output_d(data);
   output_high(LCD_E);
   delay_cycles(1);
   output_low(LCD_E);
   output_low(LCD_RS);
}

void lcd_init()
{
   int8 i;
   output_low(LCD_RS);
   output_low(LCD_RW);
   output_low(LCD_E);
   delay_ms(15);
   for (i=0; i<3; i++)
   {
      output_d(0x38);
      output_high(LCD_E);
      delay_us(1);
      output_low(LCD_E);
      delay_ms(5);
   }
   output_d(0x06);
   output_high(LCD_E);
   delay_us(1);
   output_low(LCD_E);
   delay_us(40);
   output_d(0x0E);
   output_high(LCD_E);
   delay_us(1);
   output_low(LCD_E);
   delay_us(40);
   output_d(0x01);
   output_high(LCD_E);
   delay_us(1);
   output_low(LCD_E);
   delay_ms(2);
   output_d(0x80);
   output_high(LCD_E);
   delay_us(1);
   output_low(LCD_E);
   delay_us(40);
}

void main()
{
   int8 hh=0, mm=0, ss=0;
   //-------------------------------------
   // SETUP
   //-------------------------------------
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);

   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);

   //-------------------------------------
   // MAIN PROGRAM
   //-------------------------------------
   lcd_init();
   delay_ms(500);
   printf(lcd_send_byte, "Time ");

   i2c_start();      //THIS IS WHERE IT HANGS WITH FORCE_HW ACTIVATED
   i2c_write(0xD0);   //Write to DS1307
   i2c_write(0x00);   //Address 0
   i2c_write(0x56);   //Start oscillator, Seconds = 56
   i2c_write(0x34);   //Minutes = 34
   i2c_write(0x12);   //24-h, Hours = 12
   i2c_write(0x01);   //Day = 1
   i2c_write(0x26);   //Date = 26
   i2c_write(0x01);   //Month = 01
   i2c_write(0x07);   //Year = 07
   i2c_write(0x10);   //Square-wave out 1Hz
   i2c_stop();

   delay_ms(1);

   i2c_start();
   i2c_write(0xD0);   //Write to DS1307
   i2c_write(0x00);   //Address 0
   i2c_start();
   i2c_write(0xD1);   //Read from DS1307
   ss = i2c_read();
   mm = i2c_read();
   hh = i2c_read(0);
   i2c_stop();

   printf(lcd_send_byte, "%x:%x:%x", hh, mm, ss);

}



Code:

#include <16F877A.h>
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES HS                       //High speed Osc (> 4mhz)
#FUSES PUT                      //Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected
#FUSES BROWNOUT                 //Reset when brownout detected

#use delay(clock=20000000)
//#use i2c(Master,Slow,sda=PIN_C4,scl=PIN_C3)
#use i2c(Master,Slow,sda=PIN_C4,scl=PIN_C3,force_hw)
PCM programmer



Joined: 06 Sep 2003
Posts: 20317

View user's profile Send private message

PostPosted: Sun Feb 25, 2007 1:51 am     Reply with quote

That's not my driver. This thread is supposed to be only about
questions on my driver.

Please start a new thread in the main forum and ask your question there.
Here's a link to the main CCS forum:
http://www.ccsinfo.com/forum/viewforum.php?f=1
hadeelqasaimeh



Joined: 05 Jan 2006
Posts: 105

View user's profile Send private message

PostPosted: Fri Apr 06, 2007 6:10 pm     Reply with quote

hi pcm

i wonder if i can use PIN A4 and PIN A5 as independent input or output
i try but it not work independently
thank you
PCM programmer



Joined: 06 Sep 2003
Posts: 20317

View user's profile Send private message

PostPosted: Sat Apr 07, 2007 11:15 am     Reply with quote

You didn't post the PIC that you're using. When you have a hardware-
specific question, you should post the PIC type.

On many PICs, the pin driver for Pin A4 is "open drain". It doesn't have
the ability to drive the pin to a high level. It can only drive it to a low
level. If you set the pin to be at a high level with the output_high()
function, the output will be "floating". You can fix this by adding an
external pull-up resistor to the pin. You can use 4.7K.

On some PICs, pin A5 is an "input only" pin. It doesn't have the
ability to drive the output in any way. So it can't be used with the
Flex LCD driver.
hadeelqasaimeh



Joined: 05 Jan 2006
Posts: 105

View user's profile Send private message

PostPosted: Sat Apr 07, 2007 11:49 pm     Reply with quote

i use 16f877a
applecon2000



Joined: 29 Jul 2007
Posts: 31
Location: UK

View user's profile Send private message Send e-mail MSN Messenger

ask for help
PostPosted: Tue Jul 31, 2007 8:26 pm     Reply with quote

Dear sir, can you explain the following code in LCD.C
"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
}

}
"
i do not understand the meaning of "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]);
"
why we need to set those parameters for LCD initialization?
please explain the purpose for me
I do thank you for your reply.
_________________
Enjoy our EEE
applecon2000



Joined: 29 Jul 2007
Posts: 31
Location: UK

View user's profile Send private message Send e-mail MSN Messenger

sorry for my question
PostPosted: Tue Jul 31, 2007 8:38 pm     Reply with quote

for my question shown above:
Could u just explain the meaning of the code :for(i=0 ;i < 3; i++)
{
lcd_send_nibble(0x03);
delay_ms(5);
}

lcd_send_nibble(0x02);

......................................#
what's the purpose of first "for(i=0 ;i < 3; i++)" and the code of "lcd_send_nibble(0x02); "
thanks a lot and sorry about my previous problem
_________________
Enjoy our EEE
PCM programmer



Joined: 06 Sep 2003
Posts: 20317

View user's profile Send private message

PostPosted: Tue Jul 31, 2007 10:11 pm     Reply with quote

You need to use http://www.google.com to search for articles on
how to use an LCD.

For example, search using Google for:
Quote:
LCD commands

Then you get results such as this page:
http://www.geocities.com/dinceraydin/lcd/commands.htm

Also search with Google for:
Quote:
LCD initialize

Then you get this result:
http://www.myke.com/lcd.htm

Also look at the data sheet for the LCD controller.
http://www.sparkfun.com/datasheets/LCD/HD44780.pdf

Please use http://www.google.com to find answers on all LCD questions.
pokiko



Joined: 27 Jul 2007
Posts: 33

View user's profile Send private message Send e-mail

PostPosted: Fri Aug 03, 2007 7:26 am     Reply with quote

Could you give an example for 4 bit LCD by using flexlcd driver and pic18f2520 for hd44780 16x2 LCD which will write to screen just "hello". The pin congiguration have to be as follows.

LCD PIC

D7 -- RB7
D6 -- RB6
D5 -- RB5
D4 -- RB4
E -- RB3
RS -- RB2

RW is grounded. PIC's RB0 and RB1 is used for another aim. crystal oscillator is 20 MHZ.

what kind of configuration i have to make in driver.
thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 20317

View user's profile Send private message

PostPosted: Fri Aug 03, 2007 12:07 pm     Reply with quote

At the start of the Flex_LCD.c file, edit the pin list so it looks like this:
Code:
#define LCD_DB4   PIN_B4
#define LCD_DB5   PIN_B5
#define LCD_DB6   PIN_B6
#define LCD_DB7   PIN_B7

#define LCD_E     PIN_B3
#define LCD_RS    PIN_B2


Because you have the R/W pin on the LCD connected to ground, you
need to comment out the following line in the Flex_LCD.c file, as shown:
Code:
//#define USE_RW_PIN   1


Here is a demo program to display "Hello World" on the LCD:
Code:

#include <18F2520.h>
#fuses HS,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay(clock=20000000) 

#include "Flex_LCD.c"
//=======================
void main()
{
lcd_init();

lcd_putc("Hello World");

while(1);
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 3 of 7

 
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