Author Topic: Does the Vo pin on an LCD display) require a var resistor or just a 15k resistor  (Read 17813 times)

0 Members and 1 Guest are viewing this topic.

Offline FerrotoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: ca
I'm trying to get a Lumex LCD display that appears to be a Hitachi clone working. I don't have a variable resistor can I get away with a fixed value resistor or is there some reason it's a variable resistor?
Datasheet: http://www.lumex.com/pdf/LCM-S01602DTR+M.pdf

Heres the schematic
« Last Edit: November 04, 2009, 03:21:45 am by Ferroto »
 

Offline XynxNet

  • Regular Contributor
  • *
  • Posts: 185
  • Country: de
The displays i use adjusts the contrast with v0. If you use a normal resistor you will loose the ability to adjust the display contrast.
It depends on your project wheather you can live with fixed display contrast.
 

Andrew

  • Guest
You could drive the contrast with PWM from the micro. That way it gets software adjustable. The old story: less hardware requires more software.
 

Offline FerrotoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: ca
At the moment i'm haveing trouble getting it to display anything at all i found demo code with the pickit2 cd and according to it's instructions I wired the display up for 4-bit mode but it simply won't light up the code compiles fine too. also the R/W pin the code doesn't do anything with it so since it's write when low I'm useing a pull down resistor even though it's not in the schematic.

Code: [Select]
#include <pic.h>
/*  cLCD.c - Write a String to a 4 Bit Hitachi 44780 LCD I/F

This Program Initializes Hitachi 44780 Based LCD in 4 Bit Mode
  and then writes a simple string to it.  The simulator was used
  to time delay values.  

LCD Write Information can be found at http://www.myke.com

RC3:RC0 - LCD I/O D7:D4 (Pins 14:11)
RC4     - LCD E Clocking Pin
RC5     - LCD R/S Pin

myke predko
04.11.08

*/

__CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS & UNPROTECT \
  & UNPROTECT & BORDIS & IESODIS & FCMDIS);

int i, j, k, n;                 //  Use Global Variables for Debug

//                         1234567890123456
const char TopMessage[] = "    PIC MCU     ";
const char BotMessage[] = "  Evil Genius   ";

#define E  RC4                  //  Define the LCD Control Pins
#define RS RC5

const int Twentyms = 1250;      //  Declare a Constant for 20 ms Delay
const int Fivems = 300;
const int TwoHundredus = 10;

LCDWrite(int LCDData, int RSValue)
{

    PORTC = (LCDData >> 4) & 0x0F;  //  Get High 4 Bits for Output
    RS = RSValue;
    E = 1;  E = 0;              //  Toggle the High 4 Bits Out

    PORTC = LCDData & 0x0F;     //  Get Low 4 Bits for Output
    RS = RSValue;
    E = 1;  E = 0;              //  Toggle the Low 4 Bits Out

    if ((0 == (LCDData & 0xFC)) && (0 == RSValue))
        n = Fivems;             //  Set Delay Interval
    else
        n = TwoHundredus;

    for (k = 0; k < n; k++);    //  Delay for Character

}  //  End LCDWrite

main()
{

    PORTC = 0;                  //  Start with Everything Low
    //CMCON0 = 7;                 //  Turn off Comparators
    ANSEL = 0;                  //  Turn off ADC
    TRISC = 0;                  //  All of PORTC are Outputs

//  Initialize LCD according to the Web Page
    j = Twentyms;
    for (i = 0; i < j; i++);    //  Wait for LCD to Power Up

    PORTC = 3;                  //  Start Initialization Process
    E = 1;  E = 0;              //  Send Reset Command
    j = Fivems;
    for (i = 0; i < j; i++);

    E = 1;  E = 0;              //  Repeat Reset Command
    j = TwoHundredus;
    for (i = 0; i < j; i++);

    E = 1;  E = 0;              //  Repeat Reset Command Third Time
    j = TwoHundredus;
    for (i = 0; i < j; i++);

    PORTC = 2;                  //  Initialize LCD 4 Bit Mode
    E = 1;  E = 0;
    j = TwoHundredus;
    for (i = 0; i < j; i++);

    LCDWrite(0b00101000, 0);    //  LCD is 4 Bit I/F, 2 Line

    LCDWrite(0b00000001, 0);    //  Clear LCD

    LCDWrite(0b00000110, 0);    //  Move Cursor After Each Character

    LCDWrite(0b00001110, 0);    //  Turn On LCD and Enable Cursor

    for (i = 0; TopMessage[i] != 0; i++)
        LCDWrite(TopMessage[i], 1);

    LCDWrite(0b11000000, 0);    //  Move Cursor to the Second Line

    for (i = 0; BotMessage[i] != 0; i++)
        LCDWrite(BotMessage[i], 1);

    while(1 == 1);              //  Finished

}  //  End cLCD


« Last Edit: November 05, 2009, 02:19:54 am by Ferroto »
 

Offline jimmc

  • Frequent Contributor
  • **
  • Posts: 304
  • Country: gb
On your latest post you seem to have crossed the supply to the LCD module!

You can used a fixed resistor for the contrast but it should be returned to Vss not Vdd,
connecting it to Vdd will give zero contrast ie a blank display.

Jim
 

Offline FerrotoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: ca
On your latest post you seem to have crossed the supply to the LCD module!

You can used a fixed resistor for the contrast but it should be returned to Vss not Vdd,
connecting it to Vdd will give zero contrast ie a blank display.

Jim

the mistake confusing the + and - for the LCD was only in the schemattic, however i corrected the issue now Vo goes to GND through the resistor it still doesn't seem to work is it possible I fried the display with a logic signal that was too high a voltage. the datasheet for the LCD was 5v peak to peak. I read the entire i\o section in the datasheet for the 16f690 and can't find the output voltage for it.
« Last Edit: November 16, 2009, 11:30:19 am by Ferroto »
 

Offline jimmc

  • Frequent Contributor
  • **
  • Posts: 304
  • Country: gb
Assuming the PIC is running off the same 5v as the LCD then there will be no problem, the high level output voltage is equal to the supply.
I assume you still have the LCD R/W line pulled low.
The unused LCD data inputs should also be connected to 0v (via a resistor, say, 10k just in case you decide to operate in read mode).

For a similar display I have, the data sheet shows that for optimum contrast, (VDD-VO) is typically 4.4v, as IO is 200uA typ, you should reduce the 15k resistor (R?) to 2k7 or 3k3.
(Your data sheet shows 4.2v@50oC, 4.8v@0oC. It's under absolute maximum ratings, which I'm sure is the wrong section, this should be under characteristics. Connecting VO to anything between VDD and VSS is safe.)

I should just add that these voltages are for optimum contrast, you will get reasonable contrast over quite a wide range.

Sorry I can't help with the programming.

Jim
« Last Edit: November 16, 2009, 08:24:53 pm by jimmc »
 

Offline FerrotoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: ca
Been busy lately only just got a chance to try it. What happened is the First row of digits lit up solid bars and the second row didn't light up. I removed the MCU and re-powered the circuit and same result indicating the LCD was acting alone when it lit up the first line with solid bars which means a software issue. Does anyone know of any good LCD driver code that I could use that's compatible with a Hitachi 44780 LCD controller.

*edit* I'm now useing different code and getting better results now a blinking cursor still can't get any text.


LCD.c
Code: [Select]
/*
 * LCD interface example
 * Uses routines from delay.c
 * This code will interface to a standard LCD controller
 * like the Hitachi HD44780. It uses it in 4 bit mode, with
 * the hardware connected as follows (the standard 14 pin
 * LCD connector is used):
 *
 * PORTC bits 0-3 are connected to the LCD data bits 4-7 (high nibble)
 * PORTA bit 3 is connected to the LCD RS input (register select)
 * PORTA bit 1 is connected to the LCD EN bit (enable)
 *
 * To use these routines, set up the port I/O (TRISA, TRISD) then
 * call lcd_init(), then other routines as required.
 *
 */

#ifndef _XTAL_FREQ
 // Unless specified elsewhere, 4MHz system frequency is assumed
 #define _XTAL_FREQ 20000000
#endif


#include <htc.h>
#include "c:\Projects\LCD_test1\lcd.h"

#define LCD_RS RB4
#define LCD_RW RB6
#define LCD_EN RB5

#define LCD_DATA PORTC

#define LCD_STROBE() ((LCD_EN = 1),(LCD_EN=0))

/* write a byte to the LCD in 4 bit mode */

void
lcd_write(unsigned char c)
{
__delay_us(40);
LCD_DATA = ( ( c >> 4 ) & 0x0F );
LCD_STROBE();
LCD_DATA = ( c & 0x0F );
LCD_STROBE();
}

/*
 * Clear and home the LCD
 */

void
lcd_clear(void)
{
LCD_RS = 0;
lcd_write(0x1);
__delay_ms(2);
}

/* write a string of chars to the LCD */

void
lcd_puts(const char * s)
{
LCD_RS = 1; // write characters
while(*s)
lcd_write(*s++);
}

/* write one character to the LCD */

void
lcd_putch(char c)
{
LCD_RS = 1; // write characters
lcd_write( c );
}


/*
 * Go to the specified position
 */

void
lcd_goto(unsigned char pos)
{
LCD_RS = 0;
lcd_write(0x80+pos); // origional
//lcd_write(0x20+pos); //temp
}

/* initialise the LCD - put into 4 bit mode */
void
lcd_init()
{
char init_value;

ADCON1 = 0x06; // Disable analog pins on PORTA

init_value = 0x3;
TRISB=0;
TRISC=0;
LCD_RS = 0;
LCD_EN = 0;
LCD_RW = 0;

__delay_ms(15); // wait 15mSec after power applied,
LCD_DATA = init_value;
LCD_STROBE();
__delay_ms(5);
LCD_STROBE();
__delay_us(200);
LCD_STROBE();
__delay_us(200);
LCD_DATA = 2; // Four bit mode
LCD_STROBE();

lcd_write(0x28); // Set interface length
lcd_write(0xF); // Display On, Cursor On, Cursor Blink
lcd_clear(); // Clear screen
lcd_write(0x6); // Set entry Mode
}




LCD.h
Code: [Select]
/*
 * LCD interface header file
 * See lcd.c for more info
 */

/* write a byte to the LCD in 4 bit mode */

extern void lcd_write(unsigned char);

/* Clear and home the LCD */

extern void lcd_clear(void);

/* write a string of characters to the LCD */

extern void lcd_puts(const char * s);

/* Go to the specified position */

extern void lcd_goto(unsigned char pos);

/* intialize the LCD - call before anything else */

extern void lcd_init(void);

extern void lcd_putch(char);

/* Set the cursor position */

#define lcd_cursor(x) lcd_write(((x)&0x7F)|0x80)




main.c
Code: [Select]
void
main(void)
{
lcd_init();
lcd_goto(0); // select first line
lcd_puts("123456789");
lcd_goto(0x40); // Select second line
lcd_puts("Oh Hai There");

for(;;);
}

also inorder to get the blinking cursor i need to comment out the following lines otherwise I just get all solid blocks on the first line and nothing on the second.
Code: [Select]
lcd_goto(0x40); // Select second line
lcd_puts("Oh Hai There");
« Last Edit: November 27, 2009, 04:04:09 am by Ferroto »
 

Offline qno

  • Frequent Contributor
  • **
  • Posts: 422
  • Country: nl
I had the same problem using an old display from a fax machine.

It turned out to be the contrast. Use a potmeter to st the contrast voltage from 0to 5 volt. Can be very sensitive!!

If the display is working you should be able to change the contrast from totaly blank to black even if no character is displayed. Once this is working you can check the connections and control line.

Start with the control lines. If you get garbage on the display some datalines may be switched.
Why spend money I don't have on things I don't need to impress people I don't like?
 

Offline jimmc

  • Frequent Contributor
  • **
  • Posts: 304
  • Country: gb
Now that you've got a visible display things should be a bit easier. :)
I know most people use a pot from VSS to VDD, but your data sheet shows, optimum contrast is obtained between  4.2 and 4.8v (VDD-VO) so over 80% of the travel is never used!

The initialisation routine for these displays is not simple, I use the sequence shown in the attachment.
(I tried inserting it as 'code' but the formatting was lost.)

It is important to wait some time after power-up for the display to sort itself out, I use 250mS.
To ensure that the initialisation is bullet proof it is best not to assume the state of the display at the start, hence the repeated lines at the beginning.
The delays are not critical.

One final thought, you are using decoupling capacitors in the supply line aren't you.
(I'd use 100n on the processor, 100n close to the display and a 10u electrolytic somewhere on the board.)

Jim
 

Offline FerrotoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: ca
Now that you've got a visible display things should be a bit easier. :)
I know most people use a pot from VSS to VDD, but your data sheet shows, optimum contrast is obtained between  4.2 and 4.8v (VDD-VO) so over 80% of the travel is never used!

The initialisation routine for these displays is not simple, I use the sequence shown in the attachment.
(I tried inserting it as 'code' but the formatting was lost.)

It is important to wait some time after power-up for the display to sort itself out, I use 250mS.
To ensure that the initialisation is bullet proof it is best not to assume the state of the display at the start, hence the repeated lines at the beginning.
The delays are not critical.

One final thought, you are using decoupling capacitors in the supply line aren't you.
(I'd use 100n on the processor, 100n close to the display and a 10u electrolytic somewhere on the board.)

Jim

The only caps I have are 22 pF Tantalum also I'm using the PICKIT2 to power it.
I'm abit new to electronics and don't have alot of excess components nearby and theres isn't any electronics shops in my town either that sell components :(

Edit: I just checked out the capacitor code, my caps are no where near the capacitance.
« Last Edit: November 28, 2009, 01:57:24 am by Ferroto »
 

Offline jimmc

  • Frequent Contributor
  • **
  • Posts: 304
  • Country: gb
Tricky, I suspect you may get away with just 22uF tantalum decoupling caps, but you may not.
(I assume your caps are 22uF, they don't make 22pF tantalum caps)
Grab a handful of 100nF ceramic caps as soon as you can, they always come in handy.
There is a thread on decoupling in this section of the forum.

This website http://www.mikroe.com/en/ has some books which may be of interest to you, they are free to read online.

Jim
 

Offline FerrotoTopic starter

  • Frequent Contributor
  • **
  • Posts: 289
  • Country: ca
SUCCESS!!!!!

I made the decision to use Basic and a 3rd party development tool called PIC Simulator it can't program the pic but it can produce hex files which you can program with pickit2's dedicated utility. or mplab with the import function.

Pic simulator is awesome you can have custom tools and objects such as the LCD display and even step by step through the program.

Srry don't have a camera will post pictures when I do.


*edit* heres the final product now that i have a camera the second board is something else i'm working on
http://i134.photobucket.com/albums/q118/shawn6901/P1010010.jpg
« Last Edit: December 12, 2009, 12:07:58 am by Ferroto »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf