6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 10, 2024 7:50 pm

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Bus Monitor
PostPosted: Wed Sep 10, 2014 8:29 pm 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
Hi guys

I've finished the wire wrapping my 6502 project and things look ok, although I've got a slight misread on the address bus.
As part of my diag efforts I'm using a fairly rubbish home made PCB which have a 5mm LED per address/data/control bus line which is current limited it approx 2mA for each.
I have a suspicion that this is having it's own detrimental effect and on top of that I'm bored of counting lit/unlit LEDs and then converting the resulting binary to hex.

So! Here's an idea.
Utilise an Atmel 324P Microcontroller (40 pin device, 32 pins usuable for I/O) to take input from the buses and, when triggered via the falling edge of the 6502 clock, convert the binary input to hex, then output to an HD44780 LCD display.

Problem: I would need the following number pins on the 324P:
16 - Address bus (input)
8 - Data bus (input)
1 - /ROM select/control bus (input)
1 - /RAM select/control bus (input)
1 - /VIA select/control bus (input)
1 - 6502 clock (input) [INTERRUPT detect]
8 - LCD display data lines (output)
1 - LCD R/W/Busy detect (input, possible output (but slow))
1 - LCD RS (ouput)
1 - LCD Enable (output)

Total: 39 pins

Obviously I cannot use just a 324P so I could possibly use the LCD in 4 bit mode, but that still leaves me needing 35 pins, so no go.
Another solution would be to use two 324Ps (or a 324P and another, smaller, Atmel uP) and drive the Address bus from one and the Data and Control bus lines from the other. The "Master" (address bus) 324P would pick up the 6502 clock falling edge, do it's conversion of address bus bits to characters, send them to the LCD, wait for a ready/not busy signal from the LCD then signal the "Slave" 324P which would then do the same for the data bus and control bus.

New pin count-

Master 324P:
16 - Address bus (input)
1 - 6502 clock (input) [INTERRUPT detect]
8 - LCD display data lines (output)
1 - LCD R/W/Busy detect (input, possible output (but slow))
1 - LCD RS (ouput)
1 - LCD Enable (output)
1 - Send to Slave 324P (output)
----
29 pins

Slave 324P:
8 - Data bus (input)
1 - 6502 clock (input)
8 - LCD display data lines (output)
1 - LCD R/W/Busy detect (input, possible output (but slow))
1 - LCD RS (ouput)
1 - LCD Enable (output)
1 - Receive from Master 324P (input) [INTERRUPT detect]
----
21 pins

I could use two bus trascievers/buffers to switch the LCD pins back and forth between the two uPs.

What do you guys think? Or is there a better solution that I'm missing (keeping in my I have very limited cash flow and I already have the Atmels :)).


Top
 Profile  
Reply with quote  
 Post subject: Re: Bus Monitor
PostPosted: Wed Sep 10, 2014 8:48 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8539
Location: Southern California
Besides going to a 4-bit LCD interface, you can just ground the LCD's R/W line and just delay enough that you know it's ready for more data, and it will still respond much, much too fast for the eye to detect any delay. That's what I always do. That gets you from the previously required 39 pins down to 34 pins, but you only have 32. Now instead of adding another uC and interfacing them, how about using something like a 74HC157 quad 2-input multiplexer. It will require a uC output pin to tell the '157 which set of four inputs (A or B) you want to go to the four outputs (Y), but the four you gain mean you have a net gain of 3 pins, enough to fit it all in one uC.

In a binary LED display though, if you group them in fours, it quickly becomes second-nature to mentally translate to hex; and the 65c02 definitely has the bus-driving strength for it, unlike the days of NMOS and inefficient LEDs that required a lot of current to be visible.

_________________
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  
 Post subject: Re: Bus Monitor
PostPosted: Wed Sep 10, 2014 8:52 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10976
Location: England
Might be worth looking at Quinn Dunki's design for the same problem: there's much parallel/serial and serial/parallel going on, but maybe shifters are cheap.
http://quinndunki.com/blondihacks/?p=654

Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject: Re: Bus Monitor
PostPosted: Wed Sep 10, 2014 11:07 pm 
Offline
User avatar

Joined: Mon May 12, 2014 6:18 pm
Posts: 365
I would use a 74HC164 shift register to drive the LCD. It only needs two pins since it is transparent and doesn't latch. You could drive the 4 data bits and RS with it and use exactly 32 pins. That would probably be easier than trying to coordinate communication between two MCUs.


Top
 Profile  
Reply with quote  
 Post subject: Re: Bus Monitor
PostPosted: Thu Sep 11, 2014 8:35 pm 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
Something like this?


Attachments:
Bus monitor.png
Bus monitor.png [ 124.29 KiB | Viewed 1086 times ]
Top
 Profile  
Reply with quote  
 Post subject: Re: Bus Monitor
PostPosted: Fri Sep 12, 2014 12:07 am 
Offline
User avatar

Joined: Mon May 12, 2014 6:18 pm
Posts: 365
That looks like it would work but if you want to free up one more pin, run the 1602 in 4 bit mode and and also drive RS with the 74AC164. You can connect CLR directly to Vcc without a resistor. You should not ever need to clear it with what you are doing since its output is ignored until you toggle E. You could connect the three left over outputs to anything non-timing specific, such as the power for your LED so you can turn it on and off from your code.


Top
 Profile  
Reply with quote  
 Post subject: Re: Bus Monitor
PostPosted: Fri Sep 12, 2014 5:07 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
You can even save a pin on the ATMega and stick with 8 bit mode for the LCD. Connect the data input of the shifter and the RS pin of the LCD to the same pin on the ATMega. RS is set as the 9th bit but is not clocked into the shifter.

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
 Post subject: Re: Bus Monitor
PostPosted: Mon Sep 15, 2014 12:28 pm 
Offline
User avatar

Joined: Sun Sep 08, 2013 10:24 am
Posts: 740
Location: A missile silo somewhere under southern England
Here are a couple of pics of the (almost) finished board. It's still missing the shift register IC as that still hasn't arrived :|
Due to me not having given any consideration to the layout of the design the bus monitor PBB is as large as the 6502 board :D


Attachments:
BusMonitor2.jpg
BusMonitor2.jpg [ 2.54 MiB | Viewed 1028 times ]
BusMonitor1.jpg
BusMonitor1.jpg [ 2.27 MiB | Viewed 1028 times ]
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 7 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: