Does the Vo pin on an LCD display) require a var resistor or just a 15k resistor - Page 1
Forum section: electronics / beginners

author: Ferroto
author_rank: Frequent Contributor
timestamp: November 04, 2009, 03:19:19 am
content: 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.pdfHeres the schematic

author: XynxNet
author_rank: Regular Contributor
timestamp: November 04, 2009, 03:17:51 pm
content: 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.

author: Unknown
author_rank: Unknown
timestamp: November 04, 2009, 06:54:09 pm
content: You could drive the contrast with PWM from the micro. That way it gets software adjustable. The old story: less hardware requires more software.

author: Ferroto
author_rank: Frequent Contributor
timestamp: November 05, 2009, 02:18:12 am
content: 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:#include <pic.h>/* cLCD.c - Write a String to a 4 Bit Hitachi 44780 LCD I/FThis Program Initializes Hitachi 44780 Based LCD in 4 Bit Modeand then writes a simple string to it. The simulator was usedto time delay values.LCD Write Information can be found at http://www.myke.comRC3:RC0 - LCD I/O D7:D4 (Pins 14:11)RC4 - LCD E Clocking PinRC5 - LCD R/S Pinmyke predko04.11.08*/__CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS & UNPROTECT \& UNPROTECT & BORDIS & IESODIS & FCMDIS);int i, j, k, n; // Use Global Variables for Debug// 1234567890123456const char TopMessage[] = " PIC MCU ";const char BotMessage[] = " Evil Genius ";#define E RC4 // Define the LCD Control Pins#define RS RC5const int Twentyms = 1250; // Declare a Constant for 20 ms Delayconst int Fivems = 300;const int TwoHundredus = 10;LCDWrite(int LCDData, int RSValue){PORTC = (LCDData >> 4) & 0x0F; // Get High 4 Bits for OutputRS = RSValue;E = 1; E = 0; // Toggle the High 4 Bits OutPORTC = LCDData & 0x0F; // Get Low 4 Bits for OutputRS = RSValue;E = 1; E = 0; // Toggle the Low 4 Bits Outif ((0 == (LCDData & 0xFC)) && (0 == RSValue))n = Fivems; // Set Delay Intervalelsen = TwoHundredus;for (k = 0; k < n; k++); // Delay for Character} // End LCDWritemain(){PORTC = 0; // Start with Everything Low//CMCON0 = 7; // Turn off ComparatorsANSEL = 0; // Turn off ADCTRISC = 0; // All of PORTC are Outputs// Initialize LCD according to the Web Pagej = Twentyms;for (i = 0; i < j; i++); // Wait for LCD to Power UpPORTC = 3; // Start Initialization ProcessE = 1; E = 0; // Send Reset Commandj = Fivems;for (i = 0; i < j; i++);E = 1; E = 0; // Repeat Reset Commandj = TwoHundredus;for (i = 0; i < j; i++);E = 1; E = 0; // Repeat Reset Command Third Timej = TwoHundredus;for (i = 0; i < j; i++);PORTC = 2; // Initialize LCD 4 Bit ModeE = 1; E = 0;j = TwoHundredus;for (i = 0; i < j; i++);LCDWrite(0b00101000, 0); // LCD is 4 Bit I/F, 2 LineLCDWrite(0b00000001, 0); // Clear LCDLCDWrite(0b00000110, 0); // Move Cursor After Each CharacterLCDWrite(0b00001110, 0); // Turn On LCD and Enable Cursorfor (i = 0; TopMessage != 0; i++)LCDWrite(TopMessage, 1);LCDWrite(0b11000000, 0); // Move Cursor to the Second Linefor (i = 0; BotMessage != 0; i++)LCDWrite(BotMessage, 1);while(1 == 1); // Finished} // End cLCD

author: jimmc
author_rank: Frequent Contributor
timestamp: November 05, 2009, 04:22:18 pm
content: 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

author: Ferroto
author_rank: Frequent Contributor
timestamp: November 16, 2009, 11:28:04 am
content: Quote from: jimmc on November 05, 2009, 04:22:18 pmthe 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.

author: jimmc
author_rank: Frequent Contributor
timestamp: November 16, 2009, 03:22:22 pm
content: 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 IOis 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 VOto anything between VDDand VSSis 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

author: Ferroto
author_rank: Frequent Contributor
timestamp: November 27, 2009, 12:55:28 am
content: 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.cCode:/**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"#defineLCD_RS RB4#defineLCD_RW RB6#define LCD_EN RB5#define LCD_DATAPORTC#defineLCD_STROBE()((LCD_EN = 1),(LCD_EN=0))/* write a byte to the LCD in 4 bit mode */voidlcd_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*/voidlcd_clear(void){LCD_RS = 0;lcd_write(0x1);__delay_ms(2);}/* write a string of chars to the LCD */voidlcd_puts(const char * s){LCD_RS = 1;// write characterswhile(*s)lcd_write(*s++);}/* write one character to the LCD */voidlcd_putch(char c){LCD_RS = 1;// write characterslcd_write( c );}/** Go to the specified position*/voidlcd_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 */voidlcd_init(){char init_value;ADCON1 = 0x06;// Disable analog pins on PORTAinit_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 modeLCD_STROBE();lcd_write(0x28); // Set interface lengthlcd_write(0xF); // Display On, Cursor On, Cursor Blinklcd_clear();// Clear screenlcd_write(0x6); // Set entry Mode}LCD.hCode:/**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 */#definelcd_cursor(x)lcd_write(((x)&0x7F)|0x80)main.cCode:voidmain(void){lcd_init();lcd_goto(0);// select first linelcd_puts("123456789");lcd_goto(0x40);// Select second linelcd_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:lcd_goto(0x40);// Select second linelcd_puts("Oh Hai There");

author: qno
author_rank: Frequent Contributor
timestamp: November 27, 2009, 06:08:40 pm
content: 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.

author: jimmc
author_rank: Frequent Contributor
timestamp: November 27, 2009, 08:17:43 pm
content: Now that you've got a visible display things should be a bit easier.I know most people use a pot from VSSto 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

author: Ferroto
author_rank: Frequent Contributor
timestamp: November 28, 2009, 12:01:11 am
content: Quote from: jimmc on November 27, 2009, 08:17:43 pmThe 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 componentsEdit: I just checked out the capacitor code, my caps are no where near the capacitance.

author: jimmc
author_rank: Frequent Contributor
timestamp: November 29, 2009, 11:31:03 pm
content: 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 websitehttp://www.mikroe.com/en/has some books which may be of interest to you, they are free to read online.Jim

author: Ferroto
author_rank: Frequent Contributor
timestamp: December 03, 2009, 01:35:12 am
content: 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 onhttp://i134.photobucket.com/albums/q118/shawn6901/P1010010.jpg