problem on displaying on LCD - atmega32a

Go To Last Post
23 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I'm using a 16x4 LCD and library of this topic, + Atmega 32A + Atmel Studio 7

When I simulate my code in Proteus 8, everything is working and LCD shows texts.

but (physical) LCD in action doesn't show anything up. I tried with different levels of contrast already.

 

http://fs5.directupload.net/images/160517/zzfnbktj.jpg

 

What could be possible issues?

 

Attachment(s): 

Last Edited: Tue. May 17, 2016 - 12:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your mega32 doesn't look like it is wired correctly. What proteus allows you to get away with in the virtual world doesn't work in the real world.
Draw a proper schematic and work from there. There should be a zillion examples as every spotty indian kid cuts his teeth on this stuff.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I agree with KArtman the wiring looks incorrect.

 

I am going to suggest you take a look at this library:

LCD library for HD44780 based LCD's
This library can be used to access a HD44780-based character LCD module. The library can be operated in both the memory-mapped mode and in the 4-bit I/O port mode, depending on the value of LCD_IO_MODE in lcd.h.

Which you can find here:

http://homepage.hispeed.ch/peter...

 

It pretty much works right out of the box and is very well documented.  Once you get your display working then you can try out the one in the topic you highlighted.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nexaen wrote:
but (physical) LCD in action doesn't show anything up. I tried with different levels of contrast already.

So, have you gotten the >>correct<< contrast level?

 

An uninitialized character LCD will show every other row of "black boxes" with proper contrast.  If you do not get that then there is no need to try anything else...

Image result for hd44780 uninitialized

 

Image result for hd44780 uninitialized

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@ Kartman, 

I'm sorry if it wasn't clear before. I drew a schematic that better describes circuit and connections (including programmer connections)

 

http://fs5.directupload.net/images/160517/dpcjc4to.png

 

 

@ jgmdesign,

Thanks, I'll look at it also.

 

theusch,

No, unfortunately LCD is not showing those black boxes. Is it problem with LCD or wrong utilization?

you can see through this link how LCD looks like while it's turned on:

 

http://fs5.directupload.net/images/160517/zzfnbktj.jpg

Last Edited: Tue. May 17, 2016 - 07:36 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How are you adjusting the contrast?  Your schematic shows no way to do so. I agree with theusch - if you don't see the blocks on an uninitialized display, you likely have a contrast problem.

 

Why is there a 500 ohm resistor in the Vcc line to the display? 

Environment: Win 7 64-bit, Atmel Studio 7, Atmel AVRISPMKII

AVR Projects: Time display, X10 automation, matrix LEDs, Caller ID, Halloween props, Pyrotechnic (all hobby)

AVR devices: mostly ATMEGA328, ATMEGA2560, ATMEGA32, ATTINY2313, AT90S2313, AT90S8515

Other hobbies: Electronics, 3D printing, collective-pitch RC helicopters

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Connect a 1k pot between Vcc and GND.  Connect the wiper to the Vee pin and turn the pot.  you should see the bar(s) Lee is referring to at some point.  Then try your code again. 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@ klunkerbusjgmdesign,

previously I tried with a 6.8K pot for contrast on VCC (2nd LCD pin), but again no results. 

Now, I tried with a 1.3K resistor, but again no result.

(I have that 6.8 pot only, but have access to different resistors sizes)

Last Edited: Tue. May 17, 2016 - 07:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
An uninitialized character LCD will show every other row of "black boxes" with proper contrast. If you do not get that then there is no need to try anything else...
...to re-iterate.

 

And it should only be >>half<< the display.  If you get the entire display with black boxes then the contrast is too high.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nexaen wrote:
previously I tried with a 6.8K pot for contrast on VCC (2nd LCD pin), but again no results. 

Now, I tried with a 1.3K resistor, but again no result.

(I have that 6.8 pot only, but have access to different resistors sizes)

 

You'd do us a favor by showing a schematic of what exactly you've tried.  What do you mean by "...for contrast on VCC"?  Was it hooked up as jgmdesign instructed? Also, you can't mimic a pot with a single 1.3K resistor, so what do you mean by that part of the statement?

 

1K, 6.8K, 10K, the pot value isn't critical to the contrast adjustment. If you have a voltmeter, you should measure the Vo/Vee pin going from 0 to 5V as you adjust the pot from one extreme to the other.  That's what matters. 

 

You haven't answered my question about the 500 ohm resistor in series with the LCD Vcc pin. I've never seen that done.  You may not be getting the proper 5v needed at the display with that resistor there. IMO, that shouldn't be there.

EDIT: Also, if you're connecting to the LCD module by just poking the pin connectors from  your jumpers into the LCD board holes, you could be having all sorts of intermittent connection problems.    

Environment: Win 7 64-bit, Atmel Studio 7, Atmel AVRISPMKII

AVR Projects: Time display, X10 automation, matrix LEDs, Caller ID, Halloween props, Pyrotechnic (all hobby)

AVR devices: mostly ATMEGA328, ATMEGA2560, ATMEGA32, ATTINY2313, AT90S2313, AT90S8515

Other hobbies: Electronics, 3D printing, collective-pitch RC helicopters

Last Edited: Tue. May 17, 2016 - 09:28 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your schematic shows pin 3 on the LCD as "Vee".  "Vee" in electronics means "emitter voltage" and is often negative or 0 volts ground. 

 

However, every 16x2 LCD that I've ever seen has a Contrast Voltage on pin 3.  This pin is recommended to have a trim pot adjustment on it to set the LCD contrast between 0 and 5 volts.  In my experience, +0.7 volts on the contrast pin usually works OK.  The +0.7 v can be applied to this pin by using a simple signal diode like the 1n914 with the anode on the pin 3 and the cathode on ground.  This forces the contrast to +0.7v by using the silicon diode voltage drop.

 

Other problems that happen with LCD modules can be traced to not using the initialization procedure listed in the data sheet, especially the delay timings.

 

I might suggest to start moving away from 16x2 LCD displays and start tinkering with TFT displays like the ST7735 128x160 pixel unit.  These units are roughly the same price as a 16x2 LCD (about $3-5 USD on eBay) and can convey much more useful information to the user.  Plus a TFT with a built-in touch screen costs about a dollar more and allows you to remove all the knobs, encoders, pots, and push-buttons needed for your user-input requirements.

Last Edited: Wed. May 18, 2016 - 01:41 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nexaen wrote:

 

http://fs5.directupload.net/images/160517/zzfnbktj.jpg

 

Do not expect us to go to an unknown site to click on your images. Use this website's capabilities. Simply click on your image, Ctrl-C, then Ctrl-V into your post.

 

Ross

Moderator

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Has it initialized properly?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi

i couldn't download your schematic

but if you have used portC for lcd pins 

the problem is associated to jtag fusebit that is active on defalt state in atmega32

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No bypass caps, and I only see power on one side of the mpu?????????

 

 

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
No bypass caps, and I only see power on one side of the mpu?????????
theusch wrote:
theusch wrote: An uninitialized character LCD will show every other row of "black boxes" with proper contrast. If you do not get that then there is no need to try anything else... ...to re-iterate. And it should only be >>half<< the display. If you get the entire display with black boxes then the contrast is too high.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you all for all your helps. you guys are great.

 

My problem was solved.

As mentioned by you earlier, I was not adjusting contrast on correct pin. I was doing it on Pin2 instead of Pin3.

and I used that 6.8k Pot and now everything is fine.

 

Thank you theusch, for telling me about those black boxes

jgmdesign, for telling me about the Pot and Library suggestion

klunkerbus, for pointing on wrong resistor and telling me about Pot

Simonetta, for mentioning Pins on LCD

Last Edited: Thu. May 19, 2016 - 08:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Still no bypass caps though. Stand by for another post in about a week along the lines of 'my code keeps crashing'.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild, I read this article and also some topics [1], [2], [3] on forums, and I found that it's good to use 0.1uf on VCC and AVCC pins of uC. Am I correct?

Last Edited: Fri. May 20, 2016 - 08:39 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nexaen wrote:

Am I correct?

 

Yes. And an electrolytic in the range 10uF to 100uF somewhere on your board as well. A good rule of thumb for normal circuits, ie your average microcontroller, is one 0.1uF capacitor for every IC or module power pin connected to VCC. So on your circuit that'll be two on the AVR and one on the LCD.

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Brian Fairchild wrote:
And an electrolytic in the range 10uF to 100uF somewhere on your board as well.

where exactly? what Pin?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nexaen wrote:

where exactly?

 

Somewhere. Across the incoming power connections is good.

 

 

#1 Hardware Problem? https://www.avrfreaks.net/forum/...

#2 Hardware Problem? Read AVR042.

#3 All grounds are not created equal

#4 Have you proved your chip is running at xxMHz?

#5 "If you think you need floating point to solve the problem then you don't understand the problem. If you really do need floating point then you have a problem you do not understand."