6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Nov 23, 2024 2:56 pm

All times are UTC




Post new topic Reply to topic  [ 24 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Thu Dec 15, 2022 7:50 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8545
Location: Southern California
Dr Jefyll wrote:
Paganini wrote:
... a known-working design to run known-working code.
Design, yes. Code... maybe not so much. According to Garth, "a reliable reset and setup requires writing the function set three times as shown there; and if you don't do that, you can sometimes get problems like you're talking about."

The code is in the file he posted, so I saw the three-times thing is not there.  It's also apparently made to work without RAM, since there are no subroutine calls, and the code to feed each letter is straightlined. :o  (I don't know what the ".s" file extension is to stand for.  I've always only seen ".asm" for assembly-language source-code files; but since the computer didn't know what to open it with, I just tried the text editor, and that worked.)

All the intelligent character LCDs I've worked with—and that's a lot, of many sizes—used the Hitachi 44780 and support ICs, with the possible exception of a couple that had the die mounted directly on the board, with bondwires going directly to the board, and covered with a blob of epoxy, meaning I couldn't see if it was Hitachi or not.  Although it wouldn't surprise me if there are other brands, I don't recall ever seeing any others.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 16, 2022 7:41 pm 
Offline

Joined: Fri Apr 15, 2022 1:56 pm
Posts: 47
Location: San Antonio, TX, USA
besser435 wrote:
Sorry, I forgot about that. The code can be viewed as plain text here: https://eater.net/downloads/hello-world.s
That version of the code is intended to be used with the slow clock. It won't work with the 1MHz crystal because it does not include logic to wait for the LCD to be 'ready' before sending each command, hence the missing characters. You'll want the 'final' version of the code instead: https://eater.net/downloads/hello-world-final.s.


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 16, 2022 8:29 pm 
Offline

Joined: Fri Apr 15, 2022 1:56 pm
Posts: 47
Location: San Antonio, TX, USA
Paganini wrote:
If I remember correctly, Ben's code worked on Blue April but only at power up. The power up met the LCD module's setup requirements, but a system reset did not; so it would stop working after a reset. Using the full setup sequence Garth described along with some appropriately proportioned delay loops let me run Blue April at 8Mhz (instead of 1Mhz!) and also switch the LCD to 4-bit mode.
For me, Ben's code worked fine at higher clock speeds and after power on or reset, as long as I was using 8-bit mode for the LCD. It was only once I switched to 4-bit mode that I discovered the need for the extended "3x" initialization sequence which handles the LCD being in an unknown state re 8-bit vs. 4-bit mode depending on power on vs. reset. In my experience, as long as the LCD is never put into 4-bit mode, the shorter initialization sequence is reliable since it can count on the LCD being in 8-bit mode when it runs.


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 16, 2022 8:33 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8545
Location: Southern California
pjdennis wrote:
Paganini wrote:
If I remember correctly, Ben's code worked on Blue April but only at power up. The power up met the LCD module's setup requirements, but a system reset did not; so it would stop working after a reset. Using the full setup sequence Garth described along with some appropriately proportioned delay loops let me run Blue April at 8Mhz (instead of 1Mhz!) and also switch the LCD to 4-bit mode.
For me, Ben's code worked fine at higher clock speeds and after power on or reset, as long as I was using 8-bit mode for the LCD. It was only once I switched to 4-bit mode that I discovered the need for the extended "3x" initialization sequence which handles the LCD being in an unknown state re 8-bit vs. 4-bit mode depending on power on vs. reset. In my experience, as long as the LCD is never put into 4-bit mode, the shorter initialization sequence is reliable since it can rely on the LCD being in 8-bit mode when it runs.

When we had the problem at work, we were using only 8-bit mode.  The problem was solved with the 3x initialization.  I did not try 4-bit mode until a few years later.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Sat Dec 17, 2022 12:53 am 
Offline

Joined: Fri Apr 15, 2022 1:56 pm
Posts: 47
Location: San Antonio, TX, USA
GARTHWILSON wrote:
When we had the problem at work, we were using only 8-bit mode.  The problem was solved with the 3x initialization.  I did not try 4-bit mode until a few years later.
The Hitachi datasheets currently available online (excerpt below) state that the internal reset can fail if power supply conditions are outside the supported envelope. So that is a documented scenario in which the 3x initialization (which the datasheet calls 'initializing by instruction') is required. Of course I have no idea if that could have been what Garth experienced back then at work.
Attachment:
HD44780U Internal Reset.png
HD44780U Internal Reset.png [ 279.73 KiB | Viewed 40626 times ]
Attachment:
HD44780U Internal Reset Power Supply Conditions.png
HD44780U Internal Reset Power Supply Conditions.png [ 60.54 KiB | Viewed 40626 times ]
That said, I think OPs main problem (as I posted earlier) is the code they are using does not include the LCD busy flag checks - the code they posted is an interim simplified version designed for a 'slow' clock module. I know from experience it produces garbled output when run at 1MHz, which happens because at that clock speed it sends commands to the LCD controller while it is still busy executing prior commands.


Top
 Profile  
Reply with quote  
PostPosted: Sat Dec 17, 2022 1:25 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8545
Location: Southern California
I dug up and examined the old circuit, and I calculate that the power should have come up on the LCD in about 0.25ms.  I don't have any of the old hardware here to measure.

But yes, it is imperative that you check the busy flag if there's a possibility of going too fast for the LCD to process the inputs.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 11, 2023 3:01 am 
Offline

Joined: Mon Dec 11, 2023 2:51 am
Posts: 1
I know its been a while, but I've just started tinkering with the ben eater 6502 and ran into the same issue as the Op. Ended up being the LCD display for me. Replaced the green one that came with the kit with a blue one that I found laying around with the same "1602A" labeling on the PCB, and everything worked as it should. Just wanted document what I found for future people.


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 11, 2023 3:36 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8545
Location: Southern California
Welcome, mort.

mort wrote:
I know its been a while, but I've just started tinkering with the ben eater 6502 and ran into the same issue as the Op. Ended up being the LCD display for me. Replaced the green one that came with the kit with a blue one that I found laying around with the same "1602A" labeling on the PCB, and everything worked as it should. Just wanted document what I found for future people.

Make sure you're using good static-handling precautions.  We occasionally get someone thinking their IC is bad, or saying that they changed a suspect IC and that made everything work; but I have been responsible for hundreds of thousands of ICs we've used at work in our products, and I have a few thousand at home in my personal inventory too, and to my knowledge, we have never gotten a bad one from a legitimate distributor.  (I say "legitimate" as opposed to something like eBay for example.)  IOW, it's not like buying produce at the supermarket where you know that once in a while you'll cut into a piece of fruit and find that it's bad inside, and that's just the way it is with produce.  The ICs' manufacturers test thoroughly and they and the distributors handle appropriately, so you can be sure the parts were good before we take them out of the tubes or other packaging.

The 6502 Primer (which Ben Eater seems to have gotten some of his ideas from) has a page on 74xx logic families and timing margins, and about 2/3 of the way down the page it also has a few paragraphs addressing CMOS static-handling precautions.  The Primer is about building your own 6502 computer, and has 22 logically organized sections which I hope you'll go through more or less in order.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Tue Dec 12, 2023 3:23 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
mort wrote:
Ended up being the LCD display for me. Replaced the green one that came with the kit [...] and everything worked as it should.
Welcome, mort. Glad you got the LCD working. :)

Just a reminder, though... If you haven't already, and before drawing any final conclusions, it would be good to try the original LCD again, because there's a chance it's actually not the source of the trouble.

As you may know, what can happen sometimes is, you replace a suspect part and of course in the process you wiggle or jiggle the associated connections. And it's the wiggling and jiggling that "cures" the problem, because there's a bad connection somewhere. (Bad connections are a VERY common cause of trouble.)

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 34 guests


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 post attachments in this forum

Search for:
Jump to: