Hi,
Wonder if anyone has code sample or kow how to setup
for this LCD 4x20 HD44780.
Thanks
Lee
Hi,
Wonder if anyone has code sample or kow how to setup
for this LCD 4x20 HD44780.
Thanks
Lee
Hi,
You connect the LCD as any other like the 2x16. Read your PBP manual. If still unclear post specific queries. Here is a sample LCD defination :
Code:'LCD DEFINATION***************************************************************** DEFINE LCD_DREG PORTD ' Set LCD Data port DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4) if 4-bit bus i.e, PortD.4-PORTD.7 DEFINE LCD_RSREG PORTB ' Set LCD Register Select port DEFINE LCD_RSBIT 0 ' Set LCD Register Select bit i.e, PORTC.5 DEFINE LCD_EREG PORTB ' Set LCD Enable port DEFINE LCD_EBIT 1 ' Set LCD Enable bit i.e, PORTE.4 DEFINE LCD_BITS 4 ' Set LCD bus size ot 4 bit Upper Nibble (4 or 8 bits) DEFINE LCD_LINES 4 ' Set number of lines on LCD to 4 Lines DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us DEFINE LCD_DATAUS 50 ' Set data delay time in us '*******************************************************************************
Regards
Sougata
Only one problem with the previous post, picbasic doesn't support LCDOut or any of the defines. You would need to upgrade to PRO to do it this way. That being said you may want do a little searching here or on the web. BasicStamp LCD routines should work fine for what you are doing.
Thanks for your reply.
I'm using PBPro version. When I watch carefully to the LCD, I got
the display output, but it is very blur and almost invisible.
Only viewable from a certain angle. I already adjusted the pot for
the contrast pin from 0-5 Vdc, 0 Vdc still the best, but still
unreadable. Wish there are more space to turn the pot beyond the
pot.
Wonder if there is any type of LCD that need negative voltage
at the contrast pin ?
In fact, I got 2 x 16 LCD, and they all work find with the code,
only the 4 x 20 LCD that has contrast problem.
Thanks
Hi,
Try using a negative supply. If you are using a Centre tapped transformer then you may derive it from there. An onboard Hardware PWM with a diode-cap charge pump can do the same. MAX232 has an onboard charge pump (-12V) available on its VEE pin. So a little experimentation would solve your problem
Regards
Sougata
Thanks guy.
Will experiment with negative voltage later this weekend,
hope I won't burn my LCD : -)
If you do not want to damage your 4x20 then read the 4x20 datasheet before trying anything else. I have several brands of 4x20s in use and none require a negative voltage on the contrast pin. Yours could be different but read the datasheet first.
Good Luck,
Paul Borgmeier
Salt Lake City, Utah
USA
Thanks for reply.
In fact, I read the datasheet, but somehow it just different from the real world. Anyway, just burn 1 because I plugged in the wrong cable which power up the LCD with 10 volts.
The contrast, indeed need negative voltage of up to -5.7 vdc with relative
to 0/gnd. Whereas the Vdd remain at 5.1 Vdc.
The LCD is made by OPTREX model DMC20481.
Extra Information :
There won't be any need to
DEFINE LCD_LINES 4
PBPro will work too if with DEFINE LCD_LINES 2.
Not really sure if the DEFINE LCD_LINES actually applied.
snip ....
The contrast, indeed need negative voltage of up to -5.7 vdc with relative
to 0/gnd. Whereas the Vdd remain at 5.1 Vdc.
The LCD is made by OPTREX model DMC20481.
... end snip
Wow - something is not right because my DMC20481 uses a + voltage for contrast. See the attached snippets from my DMC20481 datasheet.
Thoughts?
Paul Borgmeier
Salt Lake City, Utah
USA
yup,
this is the one I got, but it just don't work with + voltage.
I have 6 pieces of these, tried them all, and they all need
neg voltage.
Recently I bought two Hantronix HDM16216-B LCD's. I got the same results as you did. Needed a negative contrast voltage.
If your PIC has a spare unused PWM output, you can easily create a (software variable) negative voltage and drive your LCD contrast from that directly. The added bonus is that by varying the duty cycle, you have full software adjustable contrast.
Bookmarks