Go Down

Topic: [SOLVED] How to use a 2-pin crystal for IC clock? (Read 1 time) previous topic - next topic

majenko

Ah, I see what you mean now.  I would imagine from the node at the top of Rf - the output of the inverter.

Pancra85

Oh... I never saw there was a clock circuit in the Ay-3-8910 datasheet. Its in Section 4.2 (page 29)

What if I have a 4mhz crystal? The same values of R and C should work, right?

In my case, do I need to connect PIN 13 of the CD4013 to the ground? Because I don't need a clock on my microcomputer (Arduino)

Ok, tomorrow I'll try that!

Thanks, all!

Pancra85

Ok, that's some useful information... from what I see on the clock circuit in the AY-3-8910 datasheet, I should connect PIN 13 to the PSG to get 1mhz.
I have a 4mhz crystal, so PIN 1 should get an output of 2mhz and PIN 13 an output of 1mhz in my case.

Can't wait the store gets open so I can buy what I need! I already have some coding to test a tone.

Pancra85

NEED HELP AGAIN!
Ok, I did the clock circuit like the one on page 29 of the Ay-3-8910 datasheet: http://www.michael-george-hart.com/articles/computerscience/AY-3-8910_8912-Programmable_Sound_Generator.pdf
Difference is that I used a 4mhz crystal, and PIN 13 (after the inverter) goes to the PSG (in order to get 1mhz) and PIN 1 goes to PIN 11 because I don't need it's 2mhz output, no other output.
Also, I used a 330ohm R (instead of 300ohm) and 22pF capacitor (instead of 20pF) but that shouldn't be a problem, right?

Now, I think it is not working, if I connect the output to an Arduino PIN and do a Serial.print(digitalRead(1)) the amount of 0's and 1's I get is not even, for instance I get:

00110001100111 and so on...

Is there another way of testing if it works?
I followed the write and read procedures as majenco told me on another post (http://arduino.cc/forum/index.php/topic,114412.0.html) but it's not working right, and of course there is no sound coming from the channels. If it's useful I could paste some code to check if it's right.

Help?? Thanksssssssss!

Pancra85

Thanks a lot for that long and detailed reply, it was very helpful!!!
Now I understand why were the readings like that, so let's suppose that the clock works.

Quote
Your connections to the Arduino should be similar to Figure 11 in the data sheet, 8 data lines and 3 control. It's also possible to control the chip with only 2 control lines, see Section 2.3
Next, I would see if I could write to and read from a register. If you can't do that, there's probably something wrong either with your wiring or code.


The connections between PSG and Arduino are like that, and I already tied BC2 to +5v, so I already use only 2 control lines.

YOU KNOW WHAAAAAAT??? I tryed again with your test tone and it WORKS!!!

I will paste entire and corrected code on this post: http://arduino.cc/forum/index.php?topic=114412

Go Up