Beginner in digital circuitry

Let's talk about anything related to the 6502 microprocessor.
ioncannon
Posts: 41
Joined: 01 Feb 2011

Post by ioncannon »

heh, I plugged in the LCD, but not the RAM. Tried running that program I wrote earlier again, and was wondering why the CPU was screwing up. Totally forgot the stack was at 100-1ff.
ioncannon
Posts: 41
Joined: 01 Feb 2011

Post by ioncannon »

Ok, I still kept having problems with the circuit. I was able to get a fellow coworker at work to let me use their oscilloscope. I found out the Ossiliscope is generating a sin wave. We need a square one correct? I just wired the clock out from the 4 pin crystal to the clk pin on the 2A03. Could this be the cause of some problems?
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Post by GARTHWILSON »

Quote:
I found out the Ossiliscope is generating a sin wave. We need a square one correct? I just wired the clock out from the 4 pin crystal to the clk pin on the 2A03. Could this be the cause of some problems?
The crystal oscillator cans do put out a square wave. I suspect you had the oscilloscope probe on the x1 setting, which limits it to maybe a couple of MHz even if the 'scope is rated for 100MHz, 400MHz, whatever. This will make a 2MHz square wave look pretty much like a sine wave. You have to have the probe on the x10 setting to get good performance.
ioncannon
Posts: 41
Joined: 01 Feb 2011

Post by ioncannon »

If I remember correctly, we did have it at the 10x setting. The sine wave did not have any jagged edges or anything, was really smooth. However I did probe the clk out and the address lines, and they produced square waves out.

I am going to have to do a bit more research (and probably my own oscilloscope) before I can continue it seems.
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Post by BigEd »

there's more you can do without a scope though...

(on the clock question, did you look at phi2, the clock out from the CPU? That will need to be nice and square. Did you try buffering your clock can output through a logic gate before feeding it into the CPU? That's the only thing it should be driving, anyway)

I think you've shown that cpu+rom works ok, but you haven't had success yet with cpu+rom+lcd. What about cpu+rom+ram? You can signal results from your program, so you could write a small ram test to check that the ram works as expected. That will increase confidence and might show you something that needs fixing.

for the LCD problem, it's worth reviewing your circuit throughly and carefully: you need to have the address decode and the clocking right.

you may have noticed Garth sometimes posts a schematic: roughly drawn on paper and scanned. That's absolutely fine - if it's good enough for him, it's good enough for anyone here!

Cheers
Ed
ioncannon
Posts: 41
Joined: 01 Feb 2011

Post by ioncannon »

Yea, I wasn't trying to do the LCD stuff, just get it to go into loops. Tried wiring it to a Analyzer I got for $80, but nothing normal is getting outputted (I think it's the analyzer). Oh well. Anyway, I think I am going to strip it down, and try again. Will test out the diagram Garth posted.
ioncannon
Posts: 41
Joined: 01 Feb 2011

Post by ioncannon »

On the pinout page, it comments that on all memory access, the M2 pin (clock out), is HIGH. I was thinking of inverting the M2 signal, and ORing it with the enable signal from the mux. Thus only when both are 0 will the ROM enable. Same goes for RAM.

Or would feeding the M2 signal to the enable active-high pin on the mux be a better idea?

Added:

Dunno if I mentioned, but I aquired a EEPROM, so testing will be so much faster now. Anyway, ROM is being read properly. Let's see if I can get SRAM to work.

Do you know a good way to test SRAM?

Added2:

Well I am getting some kind of output :D!!! I tried running a quick test program on the sound generator of the NES CPU and I got a solid Square Wave tone!!! So this proves the ROM works, still got to test SRAM though. Will try storing value into ram, then load into the generator.
ioncannon
Posts: 41
Joined: 01 Feb 2011

Post by ioncannon »

LCD Works!!!!! I was hitting me head on the desk trying to figure out why it wasn't working. I was looking at this (http://www.6502.org/mini-projects/optrexlcd/lcd6502.gif) trying to figure out WTF it wasn't working. Then I noticed that last NAND on the E line... then checked the datasheet... E was ACTIVE-HIGH /facepalm. Well I got a character to appear on the screen WOOHOO.

Thank you BigEd, Garth, Dino, and everyone else that helped. I bought a 6551 for later, but now to write some software :D!!!!
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

Post by BigEd »

Congrats! Is RAM OK too?
ioncannon
Posts: 41
Joined: 01 Feb 2011

Post by ioncannon »

Seems so. The initialization of the LCD, and printing characters to it are done with subroutines. Same with enabling and generating sound from the sound generator. Also I threw in some loading and saving to the ram on certain parts to test it.

My professor suggested once I get the serial interface working, to create a simple machine code monitor, which would be perfect in messing with RAM.

Was looking up about the 6551. So basically I wire it to the bus, then the serial lines connect into a TTL to Serial voltage converter (going to use a MAX232) and that goes to your serial cable correct?
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Post by GARTHWILSON »

Quote:
My professor suggested once I get the serial interface working, to create a simple machine code monitor, which would be perfect in messing with RAM.

Was looking up about the 6551. So basically I wire it to the bus, then the serial lines connect into a TTL to Serial voltage converter (going to use a MAX232) and that goes to your serial cable correct?
Right. The 6551 gets some criticism for a few quirks, but it does work fine, and I have used it for decades with never a problem. Do note that DCD\ (pin 16), if you don't use it, needs to be pulled low for the receiver to operate.
ioncannon
Posts: 41
Joined: 01 Feb 2011

Post by ioncannon »

Yea, saw an example circuit. The two pins above Vcc were tied high. Forgot the other ones name but /DCD was one of em.

Everything is already pre-wired, so I just have to drop the two chips in now.

Added:

Been playing around with the NES APU that is built in (while I wait for the 6551), and got it to work! Wired up a amplifier circuit, and combined both channels to one. It's now playing glorious NES chiptunes lol. The code isn't mine though since I never played with the APU (I can't compose at all).
Post Reply