View previous topic :: View next topic |
Author |
Message |
jspink
Joined: 23 Jun 2004 Posts: 7
|
Posted: Wed Jun 23, 2004 9:17 am Post subject: Programming with a LCD |
|
|
Just starting a new terminal style project with a 40x4 LCD that supports both 8 bit and 4 bit connections. I would like to attach to it in 4 bit PIN mode, but I will need to initialise the LCD in 8 bit mode - that is ok, I have enough pins. Presume that i set the compile options to 4 bit PIN mode, but then address the high bit pins directly at the start of my code, to configure the 4 bit mode on the LCD? Is this usual? |
|
Back to top |
|
|
saqmaster
Joined: 10 Apr 2004 Posts: 42 Location: United Kingdom
|
Posted: Mon Jun 28, 2004 12:09 am Post subject: |
|
|
As far as I know, 8-bit mode isnt supported (yet).. Mark will be able to confirm..
The 40x4 display needs two EN lines I believe, you can switch these using two seperate EN outputs on your AVR and switch in your code on which bank of rows (1-2 or 3-4) you want to use.. I believe this works well from what others have said..
-Stu |
|
Back to top |
|
|
jspink
Joined: 23 Jun 2004 Posts: 7
|
Posted: Mon Jun 28, 2004 3:42 am Post subject: |
|
|
Thanks, I am using 4 bit mode and 2 enable lines. I understand how the 4 bit mode works now, with the lower bit-pins tied to ground. The LCD wakes up in 8 bit mode. Is there a procedure for applying power to the LCD and waiting before issuing CONFIG LCDBUS = 4 command? Is there a correct order of issue for LCD configuration commands? |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed Jun 30, 2004 10:26 pm Post subject: |
|
|
Hi,
You can use 2 LCD displays :
'using 2 lcd's
$regfile = "4433def.dat"
Config Lcd = 40 * 2
Dim ___lcdno As Byte
Config Lcdpin = Pin , Db4 = Portb.5 , Db5 = Portb.4 , Db6 = Portc.4 , Db7 = Portc.3 , E = Portb.1 , Rs = Portb.0 , E2 = Portb.2
___lcdno = 0
Initlcd
Cls
Lcd "Testing 1"
___lcdno = 1
Initlcd
Lcd "testting 2"
___lcdno = 0
Lowerline : Lcd "ok?"
End
One remark : your version of the compiler might not support it yet. _________________ Mark |
|
Back to top |
|
|
jspink
Joined: 23 Jun 2004 Posts: 7
|
Posted: Thu Jul 01, 2004 12:48 am Post subject: |
|
|
Thanks Mark! I have actually got going now, using the Lcd4E2.lib. I think all my problems were a mistake I made in connecting DB6 & 5 around the wrong way! Is there any advantage in using the Lcd4E2.lbx file instead? Will it reduce the code size? |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Fri Jul 02, 2004 8:42 pm Post subject: |
|
|
Using the dedicated lcd driver will result in smaller code size.
The default driver is for worst case scenario when you can use pins from different ports !!!
The dedicated driver uses fixed pins which needs less software, but maybe results in a harder PCB design. _________________ Mark |
|
Back to top |
|
|
|