Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Programming with a LCD

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
jspink

Bascom Member



Joined: 23 Jun 2004
Posts: 7

PostPosted: Wed Jun 23, 2004 9:17 am    Post subject: Programming with a LCD Reply with quote

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
View user's profile
saqmaster

Bascom Member



Joined: 10 Apr 2004
Posts: 42
Location: United Kingdom

blank.gif
PostPosted: Mon Jun 28, 2004 12:09 am    Post subject: Reply with quote

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
View user's profile MSN Messenger
jspink

Bascom Member



Joined: 23 Jun 2004
Posts: 7

PostPosted: Mon Jun 28, 2004 3:42 am    Post subject: Reply with quote

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
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5319
Location: Holland

blank.gif
PostPosted: Wed Jun 30, 2004 10:26 pm    Post subject: Reply with quote

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
View user's profile Visit poster's website
jspink

Bascom Member



Joined: 23 Jun 2004
Posts: 7

PostPosted: Thu Jul 01, 2004 12:48 am    Post subject: Reply with quote

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
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5319
Location: Holland

blank.gif
PostPosted: Fri Jul 02, 2004 8:42 pm    Post subject: Reply with quote

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
View user's profile Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum