Pages: [1]   Go Down
Author Topic: AY-3-8910  (Read 1189 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've got an AY-3-8910 PSG sitting on my desk and an Arduino board on order. Now I know I need a 595 for the data inputs on the PSG and a few other pins for the other control pins.

My problem is that I have little to know idea how to go about programing the thing. I know that both the register address and the data input use the same pins and that the other control pins allow the selection between the two. All the documentation I have on the 8910 is rather vague on this important bit.

Does anyone have any experience with this or some insight?

Thanks,

-Ian
Logged

Bristol, UK
Offline Offline
Edison Member
*
Karma: 0
Posts: 1197
Exhibitor at UK Maker Faire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I also have some AY-3-8910 chips, and used one extensively in the early 1980s (on a Compukit UK101). That main thing is to understand the BC1, BC2 and BDIR inputs.  These pins are used to determine whether you're writing to the internal address latch, writing to the registers, or reading the registers. BDIR is simply the direction of the data bus, in or out (you'll probably only be writing, unless you want to read the I/O ports). I don't have the AY-3-8910 data sheet with me at the moment, but I have one at home.  Will look it up!  Do you have any specific questions, so far?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Anachrocomputer, as soon as I looked at datasheet I found the little truth table for the read/write functions. So that makes sense now.

The specific question: When programing this as a realtime instrument (instead of just playing back files) Would the loop look something like this:
Code:
loop()

{
     set register 0;
     latch data;
     set register 1;
     latch data;
     ...
     set register15;
     latch data;
}
  

-Ian
Logged

Bristol, UK
Offline Offline
Edison Member
*
Karma: 0
Posts: 1197
Exhibitor at UK Maker Faire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, that's the basic idea, but of course if a register is unchanged from one step to the next, it need not be re-written.  You'll probably end up writing a simple API (Application Programming Interface), where you will have functions to set the mixer up, set the envelope shaper up, set the frequency of each tone channel, and so on.  Each of those will do a "set register/latch data" operation internally.

You'll also need a call to "delay ()" somewhere in that loop, to keep the timing reasonable. "delay ()" works in units of milliseconds.
« Last Edit: May 23, 2009, 04:01:11 pm by anachrocomputer » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That sounds pretty good. I'm not sure how to write an API. Would it be something like the main loop asking for or waiting for a choice of what register to change?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I, too, have experimented with the AY-3-8910 many years ago.  I used to have a few of these in my parts box, but they were lost (along w/the datasheets for them) in a fire several years ago  smiley-sad

To answer your question regarding "what is a API", it is true what Arachnocomputer said that it stands for "Application Programming Interface".  This is simply a short way of saying "a collection of subroutines/functions that make interacting with the device (or whatever) a bit easier".

What this means in this instance is that it would be a good idea to start by creating a few functions that do basic operations on the AY-3-8910.  Were I in your position, I'd start by writing two functions: PSGWriteRegister(reg, value) and perhaps Value = PSGReadRegister(reg).  After you have these two functions in your "API", you could expand it by creating functions like PSGPlayTone(channel, frequency) and PSGSetMixer().  Functions like this would likely use the first two functions suggested above (e.g. PSGWriteRegister()).  I don't remember enough about AY-3-8910's capabilities to suggest additional functions, but hopefully this will give you an idea what we mean when we speak of a "API".

Last IMHO comment: A well-designed API, that closely models the hardware that it is intended to control, and "abstracts" that hardware into a collection of functions/methods/classes that control various aspects of it can make programming a much less tedious task.  The Wiring library (API) that is included in Arduino "sketches" is an example of a API that "abstracts" many of the capabilities of the AVR microcontroller and "hides" many of the gritty details involved in such things as setting up the timers for PWM generation, acquiring analog data using the ADC, performing input/output to the USART, and so forth.  When you use functions such as Serial.init() and writeDigital() you are making use of the Wiring API.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey Mark,

If you want to play with them again, BG Micro has 8910s for about $4.00 each (datasheet included in their "Data" section): http://www.bgmicro.com/index.asp?PageAction=VIEWPROD&ProdID=12930

Thanks for the explanation of API. I'm definately going to have to do a flow chart for this thing to make sure I have all the functioons down.

-Ian
Logged

Pages: [1]   Go Up
Jump to: