ATMEGA16A LCD trouble when interfacing with different ports

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

I’m using a MCU ATmega16A and I have try with ATmega32A.

My LCD it is a character display 2 lines x 20 characters.

The LCD controller it is: Sunplus SPLC780.

 

Long time I didn’t have any problem. Since I decide to change the PORTD to the PORTA for the LCD 8-bit Data-Bus. The whole program remains intact except the definition for the Ports I use.

As long I use the PORTD for the Data-Bus of the LCD it is still function normally by using the EN, RS & RW signals at the PORTA or PORTB or PORTC without any problem.

The problem I encounter it is the characters are mispositioning or I can say skipping some characters to be displayed at the screen.

Using my debugger JTAG ICE MKII, and do step by step my code I found everything working properly and all the messages on the LCD screen it was ok.

After long time troubleshooting, I make it to work by adding a long delay of 0.75mS before the Enable signal to send the LCD instruction to read LCD busy flag and wait to be clear the busy flag. All the delays have been made according to the datasheet. The Enable pulse width with rise and fail it is 300nS (Datasheet refer Tpw = 230nS + Tr = 20nS + Tf = 20nS).

The MCU it is running an internal oscillator clock of 8MHz. I have tried also an external crystal oscillator of 8 and 16MHz, only at PORTD working all the combination without problem.

I have tried also to use a breadboard and prototyping PCB thinking maybe it is some bad wiring, but I see the same results as I have described above.

And I don’t have a logic analyzer…. To can check what it is actually happen.

 

Kindly someone advise me I feel so desperate… 5 days now I try everything to find out why happen this.

 

HAPPY NEW YEAR 2020 EVERYONE!!!

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

Welcome to AVRFreaks!

 

Your problem seems to be on line 142!

 

Jim

 

 

 

 

 

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

Your display appears to be a knockoff of the popular HD44780.  The OSC pins are a new item but essentially it's still an HD44780 device.

 

PLenty of code out there for it.   I would suggest you use Peter Fleurys library:

 

http://www.peterfleury.epizy.com...

 

Under the AVR-GCC Libraries section, " LCD library for HD44780 based LCD's "

 

That should get you going.

 

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

And of course we have no idea as to what the circuit diagram or the PCB look like.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Dear all

Thank you for your warm welcome and the prompt response

 

Dear ki0bk, you are the person who really encourage me to check more detailed my code, and to be honest you get close, I found my mistake at line 203, I have write a I/O port name  instead to use a label that I have already define in the beginning of my file…..

I feel so shame….

 

As you suggest me jgmdesign, I still study how to program in C, all my programs are written in assembly and I making my include files for any module I use like this LCD screen.

Your suggestion will be work 100% if I know C.

 

@ JS you are right, I was been so exited to join to your community and to ask for help, really this forum it is amazing, and I’m sure I have a lot to learn!

Kindly see a quick circuit diagram as you advise.

 

At the end, my problem solved and the screen working properly at all the ports 😊

 

Please let me know where I can upload my code, later when I finish my LCD include “library” file with initialization of the screen and all the available function routines, to can share with other people interesting for AVR assembly programs.

 

Attachment(s): 

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

Well if it's solved then you should post an explanation of what you did to solve the problem and mark that post as the solution.

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