Problem with LCD Interfacing

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

This is my first time interfacing with the lcd module with an atmega328p.I couldn't find the error as it was complied successfully but the LCD screen is blank.please do help.

the code is attached.

thanks in advance.

Attachment(s): 

soumikmukherjee

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

Successful compile does NOT guarantee successful operation! 

 

Do you have a correct contrast control voltage applied? Or, for that matter, even the proper LCD supply voltage? And the proper pin connections?

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Last Edited: Tue. Feb 13, 2018 - 08:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to read up on bit manipulation. Specifically the use of |=
I can’t see overall how your code would work -?it looks like you use 4 bit mode, but there’s no 4 bit operations. Why not start with known good code?

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

There are at least a billion examples of LCD code on the net, a few can even be found here on AVR freaks!  smiley

 

Do a google search for Fleury and LCD.  while your there pick up his I2C and Serial code too!   It will save much hair pulling!

 

Jim

 

Mission: Improving the readiness of hams world wide : flinthillsradioinc.com

Interests: Ham Radio, Solar power, futures & currency trading - whats yours?

 

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

Soumik Mukherjee wrote:
This is my first time interfacing with the lcd module with an atmega328p

So are you familiar with interfacing LCD modules with other microcontrollers?

 

And are you  familiar with doing other stuff with an atmega328p?

 

If neither of the above, then perhaps you should take a few steps back, and start with the basics ... ?

 

See: https://www.avrfreaks.net/comment...

 

 

EDIT

 

How to properly post source code to the forum: https://www.avrfreaks.net/comment... (including, for future reference, how to post images)

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Feb 14, 2018 - 12:14 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As far as i know to work on the 4 bit functionality of lcd i have to mask the lower 4 bits in my command write and data write functions and shift the lower nibble to higher nibble.also i looked up the datasheet and it mentioned that i shoud use different hex commands for 4 bit and 8 bit functionality.(0x38 for 8 bit and 0x28 for 4 bit).do correct me if i went wrong.

thanks in advance

soumikmukherjee

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

i double checked my pinouts from the lcd to the microcontroller's pinout and have hooked up a 10k pot for contrast control of the lcd

soumikmukherjee

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

Start with one of the many correct drivers for this LCD hardware that already work, and use that to verify that your hardware is correctly set up. Then you can debug your code while being confident that the other parts of the setup are correct.

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

Soumik Mukherjee wrote:
hooked up a 10k pot for contrast

But have you "hooked it up" correctly ?

 

Post Your schematic.

 

Also post some good, clear, in-focus photos of your setup.

 

Again, the instructions are here: https://www.avrfreaks.net/comment...

 

​How have you proven basic functionality?

eg, blinked  LED ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...