LCD_8bits
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-12-12 01:09 AM
I am trying to use an LCD HD44780 (2X40) with STM3210C-eval. I want to configure it for 8 bits mode.
#re-inventing-the-wheel- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-12-19 01:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-12-19 06:30 AM
Some hd44780 clones are slow, you can try slower clocking, longer delay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-12-19 08:06 AM
Connecting any/all of your lcd data bus to power or ground - prior to proper lcd initialization -accomplishes nothing! (in fact most all 44780/clone controllers ''pull'' the D-Bus high by default)
Here is the simplest code which can bring your first (top) line of character lcd into view: Set RS=0 Set R/W =0 Set E =0 Place 0x0E on data bus (2 steps in 4 bit mode - 1st 0X00 then pulse ''E'' H-L. Then 0x0E on data bus - again pulse ''E'' H-L. If done correctly - the pixel field should come more intensely into view. Once the pixel field is clearly viewable - place 0X01 on data bus. (again 2 steps - as above - first 0X00 then 0x01.) This 0X01 will clear the display and ''home'' the cursor. As the other poster suggests - long delays during this process will be helpful. If you can achieve this very basic ''make pixels visible'' and ''home cursor'' functionality you can graduate to fuller initialization (2 line) but ordering the display into 2 line mode may well require a slight negative voltage on Vo - as stated earlier...*** Update ***
My suggested use of the minimum 2 commands (0x0E followed by 0x01) is correct for an 8-bit bus implementation - but is inadequate (wrong) for 4 bit operation! To begin - tie 4 consecutive bits from your MCU to DB4-DB7 of the Lcd. (DB3-DB0 may float) Ideally (to simplify) you should use Port bits 4-7 from your MCU. Now 4 bit initialization is specialized - and must be followed exactly: (this from a 1994 Hitachi LCD Controller Data Book) Wait for 15mS (minimum) after Lcd's power rises to 5V. a) Clear RS and R/W and E. b) Place 0x03 on Lcd pins DB4-DB7. (i.e. DB4 & DB5 high, others low) c) drive E high for 450nS minimum - return low. d) Wait for 4.1mS (minimum) e) Place 0x03 on Lcd pins DB4-DB7. (same as earlier) f) drive E high for 450nS minimum - return low. g) Wait for 100uS (minimum) h) Place 0x03 on Lcd pins DB4-DB7. (this is the 3rd time this is done) i) drive E high for 450nS minimum - return low. j) Place 0x02 on Lcd pins DB4-DB7. (i.e. DB5 alone, high) k) drive E high for 450nS minimum - return low. l) Place 0x02 on Lcd pins DB4-DB7. m) drive E high for 450nS minimum - return low. n) Place either 0x00 (1 Line) or 0x08 (2 Lines) on Lcd pins DB4-DB7 o) drive E high for 450nS minimum - return low. p) Place 0x00 on DB4-DB7 - strobe E q) Place 0x01 on DB4-DB7 - strobe E (these 2 commands clear the Lcd) r) Place 0x00 on DB4-DB7 - strobe E s) Place 0x0E on DB4-DB7 - strobe E (display should now be visible *** Now change RS from low to high, leave R/W low t) Place 0x40 on DB4-DB7 - strobe E u) Place 0x01 on DB4-DB7 - strobe E (A should now appear @ home position!) Continue to write to the display via this back to back (2 nibble) mode - with most significant nibble sent first. Each nibble must be ''strobed in'' via a high going E pulse. 8 bit mode is far more forgiving - but does cost 4 more GPIO. If you use 4 bit mode in a noisy environment - it is wise to periodically ''re-initialize'' the Lcd - to make certain it has not become ''out of sync'' with your tranfers.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-12-24 01:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-12-24 08:06 AM
You don't state if you used the detailed, 4-bit initialization code I recently supplied. We have used such code on thousands of 44780/clone lcds (I was co-owner of lcd firm) with success.
Do you see the pixel field both before and after the new 4-bit initialization? Do you see the cursor? Did you honor the relatively long delays specified in the new, 4-bit initialization? Without correct 4-bit initialization - all is lost. I recall that your data bits were reversed in your shown code - you're placing roadblocks by not following the ''normal/customary'' set-up & pin configurations. And - it is always possible that your display has some defect (ESD etc.) Far better to work w/ a number of displays - just in case...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-12-25 03:52 AM
Your delays are definitely too short, you would rather use about 50us delays in
lcd_write_4bit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-12-25 06:26 PM
The 50uS delays you suggest are spec'ed @ 40uS for inter-character spacing when using HD44780/clone @ 5V.
However - you miss the fact that if the pixel field does not intensify - and the cursor does not ''home'' (via the detailed initialization presented) - inter-character delays will have NO impact! Initialization always comes first - and must be successful...- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-12-26 03:01 AM
You are right, of course. Feel free to find all the delay bugs. I found one of them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-12-27 01:14 AM
@sprague.jj
i use the some configuration as yours but the cursor didn't appears. juste the first line appears (low contrast).- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2012-12-27 01:15 AM