Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

dim 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
happybenguy

Bascom Member



Joined: 22 Apr 2005
Posts: 5

PostPosted: Fri Apr 22, 2005 2:22 am    Post subject: dim lcd Reply with quote

hi all. I just got my first lcd screen in and got it all hooked up today. Its a 16*1a. I am using bascom avr and am using the lcd functions. I got the lcd to come on and to display text but the text is really dim. I have the contrast pin connected to ground so that should be ok. I couldnt get it to have the characters show up darker, so i hooked it up all 8 bits and the rs and e line and wrote my own little lcd program that initializes and sends data to the lcd. That worked well and the characters were nice and dark, so i know the lcd works fine, but when i have it hooked up in 4 bit mode and use the bascom lcd functions i cannot get it to display the characters nice and dark like they were when i had it hooked up the other way. I would really like to be able to use the lcd function in bascom because doing it all manually takes forever. If anyone could help me that would be really great. Thanks
Back to top
View user's profile
DToolan

Bascom Member



Joined: 14 Aug 2004
Posts: 1384
Location: Dallas / Fort Worth, Texas (USA)

blank.gif
PostPosted: Fri Apr 22, 2005 4:33 am    Post subject: Reply with quote

I would use a pot to vary contrast. I've never had a problem with the following 4-bit connect... here
Back to top
View user's profile Yahoo Messenger
happybenguy

Bascom Member



Joined: 22 Apr 2005
Posts: 5

PostPosted: Fri Apr 22, 2005 6:37 am    Post subject: hey Reply with quote

well i tried the pot but it didnt fix the problem. I know i have everything hooked up right but im starting to think that it works well in 8bit mode and not so well in 4bit mode because it was a cheap lcd and i maybe have a low duty cycle in 4 bit mode due to the fact that it must right each character using two cycles instead of one. Im purdy sure that is whats going on so i am woundering if there is a way that i can use the basom lcd commands but output using all 8 lines from portb instead of using 4 then maybe have the rs and enable bits on porta or somthing. Is that possible? thanks for your help.
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 1198
Location: France

france.gif
PostPosted: Fri Apr 22, 2005 5:09 pm    Post subject: Reply with quote

Hi,
Would you please add
The type of µcontroler of your LCD
the type of µcontroler used (Atmega, tiny...)
speed Xtal...
a brief of the config you did
the statments you use...

did you use the IDE options\compiler\lcd or did you program it ?

But I confirm Bascom works without any Pb to drive LCD. 1, 2, 4 lines is OK

JP

_________________
pleasure to learn, to teach, to create
Back to top
View user's profile Visit poster's website
happybenguy

Bascom Member



Joined: 22 Apr 2005
Posts: 5

PostPosted: Fri Apr 22, 2005 6:02 pm    Post subject: yep Reply with quote

alrighty, here goes

lcd controller is a ks0066u, same thing as the stanard controlers as far as i can tell

got it hooked up to a mega32

using the internal rc at 8mhz

this program is the one that i hooked up in 4 bit mode and used the basom functions with and uses the lcd settings from the options menu which are set for my lcd. 16x1a-4bit-port
Code:

Do
Cls
Lcd "Hello"
Wait 1
Cls
Lcd "Bye"
Wait 1
Loop
 


but the characters are very dim using it this way, have to look at it at a certian angle just to read it, and i've hooked it up like 5 times so im quite sure its not the connections.

Then i wrote this program and hooked up the 8 data lines to porta and the rs and e lines to portc. This program manually sets up the display and then cycles through the characters and clears before each new character is sent.
Code:

Dim A As Word
Config Porta = Output
Config Portc = Output
Porta = 0
Portc = 0

Waitms 1000
Portc = 2
Waitus 10
Porta = 48   'set to 8bit
Portc = 0
Porta = 0

Waitms 100
Portc = 2
Waitus 10
Porta = 15     'turn on the display
Portc = 0
Porta = 0

Waitms 100
Portc = 2
Waitus 10
Porta = 6     'increment the adress counter after each character
Portc = 0
Porta = 0

Waitms 100
Do
Portc = 3
Waitus 10
Porta = A     'display character equal to a
A = A + 1
Portc = 1
Waitus 10
Portc = 2
Waitus 10
Porta = 2
Portc = 0
Porta = 0
Waitms 1000
If A = 256 Then A = 0  'cycle through all bits to display all characters
Loop

End
 


This program resulted in the display working correctly but as you can see its a pain doing just displaying somthing simple.

I think that running it in 4 bit mode makes it dim so thats why im wondering if I can still use the lcd functions from bascom but somehow output them in 8 bit instead of 4, or use some other work around becuase i cannot use the display if its as dim as it is now. hope i make sense here, i know it kinda a dum problem, but hopefully we can get this worked out. Thanks
Back to top
View user's profile
Duval JP

Bascom Member



Joined: 22 Jun 2004
Posts: 1198
Location: France

france.gif
PostPosted: Fri Apr 22, 2005 6:37 pm    Post subject: Reply with quote

did you unselect the JTAG ?
Port C is not working correctly with Jtag enabled !

_________________
pleasure to learn, to teach, to create
Back to top
View user's profile Visit poster's website
happybenguy

Bascom Member



Joined: 22 Apr 2005
Posts: 5

PostPosted: Fri Apr 22, 2005 8:16 pm    Post subject: k Reply with quote

heh, yep, made sure it jtag was off first too(had that probem once though and it took me forever to troubleshoot Wink )
see the thing is, is that it works the second way(8bit), but the first way it doesnt(4bit), and bascom default outputs to portb using its functions and 4bit mode. Im gonna keep messing with it tho. I'll let you know if i get it figured out. any more suggestions are well come.
Back to top
View user's profile
DToolan

Bascom Member



Joined: 14 Aug 2004
Posts: 1384
Location: Dallas / Fort Worth, Texas (USA)

blank.gif
PostPosted: Sat Apr 23, 2005 1:04 am    Post subject: Reply with quote

If your chip had an address / data bus (for connecting external memory) then you could "CONFIG LCDMODE = BUS". Afterward (with a few other config statements), the LCD commands would be as simple as usual (CLS, etc.). Unfortunately, the M32 isn't one of those chips. The 8515, M64 or M128 are some examples of chips with the alternate XRAM interface.
Back to top
View user's profile Yahoo Messenger
jenalcom

Bascom Member



Joined: 10 Apr 2004
Posts: 365
Location: Perth, Western Australia

australia.gif
PostPosted: Sat Apr 23, 2005 6:25 am    Post subject: Reply with quote

It may sound silly but -- have you tried to output without using the do..loop or using a longer wait time?


It may be that the CLS command is taking a long time on that display and you are therefore refreshing too quickly.

Just an idea

Alan
Back to top
View user's profile
happybenguy

Bascom Member



Joined: 22 Apr 2005
Posts: 5

PostPosted: Sat Apr 23, 2005 7:31 am    Post subject: 8515 huh? Reply with quote

well, i have tried to do it with just outputing one word then ending the program, but it had the same result. I do however have a 8515 laying around, so i am goin to try to figure out how to hook that up, but the way you make it sound is that i dont actually need the external ram, i just treat the lcd as the external ram, is that correct? well anyhow, im gonna try to play around with the 8515 tommarow and see what i can discover. Ill let you guys know what i find out.
Back to top
View user's profile
DToolan

Bascom Member



Joined: 14 Aug 2004
Posts: 1384
Location: Dallas / Fort Worth, Texas (USA)

blank.gif
PostPosted: Sat Apr 23, 2005 7:16 pm    Post subject: Reply with quote

No, you won't need any XRAM connected. Look in the HTML help file under "Adding XRAM". There is a diagram there showing what pins to connect to the LCD. The initialization code should be something like this...

Code:
Config Lcd = 16 * 1
Config Lcdmode = Bus
$lcdrs = &H8000             'address of enable signal
$lcd = &HC000               'address of enable and RS signal together

MCUCR = &HC0                 'Enable External Memory Access With Waitstate

'if you think you have some timing issues with your LCD in this mode
'perhaps it's related to waitstates. Read up on the EMCUCR register
'where you can set additional waitstate parameters

Wait 1

LCD "TEST"
Back to top
View user's profile Yahoo Messenger
ATIU

Bascom Member



Joined: 15 Oct 2004
Posts: 534

philippines.gif
PostPosted: Wed Apr 27, 2005 5:36 am    Post subject: Reply with quote

You should look at the datasheet of your LCD on how to hook up the contrast bias voltage. Some requires negative bias while most will work with Vcc and Gnd. A pot, one connected to Vcc (+5v) and Gnd, while the center of the pot goes to the bias pin. My experience is that bias voltage is just about 0.5V, so connecting this to gnd will not work, or just darken the whole LCD. If connected a pot, then the other end should be connect to Vcc.
Back to top
View user's profile
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