Show Posts
Pages: 1 ... 4 5 [6] 7
76  Using Arduino / General Electronics / Re: How to use a 2-pin crystal for IC clock? on: July 20, 2012, 02:32:58 am
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
77  Using Arduino / General Electronics / Re: Help with the AY-3-8910 IC datasheet! on: July 19, 2012, 05:54:56 pm
Hahaha, I'm glad you took responsibility for that!
No problem, I'll try again replacing all those "1111" with "0000" on the register addresses and report back.
I saw somewhere else that the high order bits were all "1" but maybe it was something else...
78  Using Arduino / General Electronics / Re: Help with the AY-3-8910 IC datasheet! on: July 19, 2012, 01:03:36 pm
I know I am asking so many things, but please be patient with me, I am new to Arduino!

I tried with a clock circuit and also with a code clock using PIN 3 of Arduino.
I get no sound from any channel, could you please take a look at this code and tell me if I am in the right direction???

On the main loop, just to test for sound on Channel A I do this:

Code:
void loop() {
  delay(3000);
  writeICFun(7,62); //Mixer: channel A only
  writeICFun(1,50); //Channel A course pitch
  writeICFun(8,15); //Volume A to max
}

To write a value to a register I use these functions:

Code:
void writeICFun(int reg,int valor) {
  //address to R01 is 11110001. If reg=1, then we need to add: 11110000 -> 240(dec)
  reg=reg+240;

  inactiveModeFun();
  Serial.println("Write on Reg number: ");
  writeBusFun(reg); //sends address of register
  latchModeFun();
  inactiveModeFun();
  Serial.println("Value to write :");
  writeBusFun(valor); //send value
  writeModeFun(); 
  inactiveModeFun();
}

void writeBusFun(int value) {
  Serial.println(value,BIN); 
  for (int x=0;x<8;x++) {
    digitalWrite(dataPins[x],bitRead(value,x));
  }
  Serial.println("-FIN Write-");
}
void inactiveModeFun(){
  digitalWrite(bdirPin,0);
  digitalWrite(bc1Pin,0);
}
void readModeFun(){
  digitalWrite(bdirPin,0);
  digitalWrite(bc1Pin,1);
}
void writeModeFun(){
  digitalWrite(bdirPin,1);
  digitalWrite(bc1Pin,0);
}
void latchModeFun() {
  digitalWrite(bdirPin,1);
  digitalWrite(bc1Pin,1);
}

Thanks a lot!
79  Using Arduino / General Electronics / Re: How to use a 2-pin crystal for IC clock? on: July 18, 2012, 10:13:15 pm
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!
80  Using Arduino / General Electronics / Re: How to use a 2-pin crystal for IC clock? on: July 18, 2012, 12:53:01 pm
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.
81  Using Arduino / General Electronics / Re: How to use a 2-pin crystal for IC clock? on: July 17, 2012, 09:48:53 pm
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!
82  Using Arduino / General Electronics / Re: How to use a 2-pin crystal for IC clock? on: July 17, 2012, 11:24:22 am
hahaha... I'm also lost...

I mean, where from the last circuit on this page http://www.z80.info/uexosc.htm do I get the CLOCK OUT signal? On every diagram on that page there is a Vcc, a Vss and a Vout (for the clock I guess) but the last one lacks Vcc and Vout.
From what part I get the CLOCK signal?
83  Using Arduino / General Electronics / Re: How to use a 2-pin crystal for IC clock? on: July 17, 2012, 10:50:46 am
... every step I take I realize there is something wrong.

I will try to use arduino as the inverter gate but... Where do I get the Clock output from the last circuit??? From one of the crystal pins? Also is it ok it doesn't have Vcc? Everything is connected to ground.
84  Using Arduino / General Electronics / Re: How to use a 2-pin crystal for IC clock? on: July 17, 2012, 10:28:50 am
oh, I got the name wrong, its not an "8", its a "B"
so it is: CD4013BCN - Dual D Flip-Flop.

I was thinking... what about instead of using the inverter, getting that to the arduino so the arduino can invert the signal? Would that work?
85  Using Arduino / General Electronics / Re: How to use a 2-pin crystal for IC clock? on: July 17, 2012, 10:18:33 am
wait a moment... looking at the CD40138CN datasheet: http://pdf1.alldatasheet.com/datasheet-pdf/view/8166/NSC/CD4013.html
I see that you need a clock to drive it... so I'm guessing that doesn't work as an inverter, right?

it seems that at the moment my last option would be to get the clock out of arduino.
86  Using Arduino / General Electronics / Re: How to use a 2-pin crystal for IC clock? on: July 17, 2012, 09:57:01 am
So it seems that a canned crystal oscillator is not so easy to find here on my city.
I bought 2x 22pF capacitors and a CD40138CN IC for the logic inverter (datasheet: http://pdf1.alldatasheet.com/datasheet-pdf/view/8166/NSC/CD4013.html) using also 2x100k R, I will try the the circuit at the bottom of this page http://www.z80.info/uexosc.htm
If that doesn't work I will try doing what Coding Badly proposed.

I'll tell you how this goes...
87  Using Arduino / General Electronics / Re: How to use a 2-pin crystal for IC clock? on: July 16, 2012, 10:29:41 pm
Thanks, for the link Majenco!
It seems not so easy, and I don't want to mess with a lot of electronics at this point.

Tomorrow I will see if they have an oscillator in the store.
Out of curiosity, how do you output a clock signal from arduino? I've tried with a counter, everytime it reaches 8 it inverts a signal, so if Arduino is 16mhz, this should be 16/8=2mhz. But I don't think you can rely on it, is there another way?
88  Using Arduino / General Electronics / [SOLVED] How to use a 2-pin crystal for IC clock? on: July 16, 2012, 06:06:28 pm
I need give to a IC (Ay-3-8910) a clock of 2mhz.
In a store I bought a 4mhz crystal because they didn't have a 2mhz crystal, and it has 2 pins
Now I did some research and it seems that what I have is not an oscillator, it's just a crystal and you need extra circuitry in order to get a clock signal.

Is there a way I can use my 2 pin crystal for the IC? Or do I need a 4 pin crystal oscillator?

Thanks!
89  Using Arduino / General Electronics / Re: Help with the AY-3-8910 IC datasheet! on: July 16, 2012, 05:53:42 pm
Thanks! Don't think I didn't read the datasheet, I read it a lot of times but didn't see that!
 
Already coded it, now I need to get the 2mhz crystal oscillator, got a crystal but it has 2 pins... I think I needed the 3 one with 3 pins  smiley-confuse
90  Using Arduino / General Electronics / Re: Help with the AY-3-8910 IC datasheet! on: July 15, 2012, 06:48:36 pm
Hey, thanks for your time!
So, to select R01 the address should be: 11110001, right?

Another question, I am worried about the speed that the data output bite changes, so what about I do this:

1) send register address
2) select latch mode (so it takes the data from step 1)
3) select inactive mode (BDir:0, BC2:1, BC1:0)
4) send register value
5) select write mode (taking the above data)
6) inactive mode again

would that work???
Pages: 1 ... 4 5 [6] 7