laurentd75 / AY-3-8930-Arduino-Test

Basic test code for the Microchip AY8930 sound chip connected to an Arduino.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AY-3-8930-Arduino-Test

The AY-3-8930, produced by Microchip Technologies, is a 40-pin enhanced and mostly-backwards-compatible version of the original AY-3-8910 programmable sound generator by General Instrument.

While sharing the same pinout (although the BC2 pin is ignored and assumed to be 0 regardless of the pin state) and register-level interface as the AY-3-8910, the AY-3-8930, has a number of enhancements over the original: Amongst other things, it features three envelope shapers, 16-bit tone generator control registers, and an improved noise generator and duty cycle control.

This Arduino sketch tests an AY-3-8930 chip by setting up some initial configuration and generating sounds. The Arduino's ADC (analog-to-digital converter) is used, along with a pot, to control the sound generator.

Test Plan

We want to verify both that the chip works and that it has the enhanced functionality (i.e. that it really is an AY-3-8930, or "AY8930" for short). So the Arduino sketch switches the chip into enhanced mode by setting the upper four bits of the ENVELOPE register (R13) to 1010 or 1011. The function 'aywrite()' that accesses the chip must keep track of which bank is selected and change banks if required to allow us to set up registers beyond the 16 of the AY-3-8910. 'aywrite()' takes register numbers from 0 to 31, with 0-15 being in Bank A and 16-31 being in Bank B.

Once we can use the enhanced features of the AY8930, we set it up in such a way that listening to the output will demonstrate that it has more than one envelope generator. Channel A is set up to produce a tone, and Channel B produces noise. Both channels are fed through envelope generators set to produce a triangle-wave envelope (rampling up and down alternately). Channel A tone frequency and envelope period are controllable via pots connected to the Arduino analog inputs 0 and 1. Channel B envelope period and noise parameters are fixed.

When the sketch runs, we should hear a pulsating tone and a pulsating noise. Only the tone should be controllable by the pots; the noise should be unaffected. I/O Port B of the AY8930 should count up at 50Hz. LEDs connected to higher-order bits (e.g. pins 9 and 10 of the chip) should flash at a moderate rate.

AY8930 Chip

AY8930 chip

AY8930 on Breadboard

AY8930 rig

Test videos

https://www.youtube.com/watch?v=S6DzIqfoHH0

About

Basic test code for the Microchip AY8930 sound chip connected to an Arduino.

License:GNU General Public License v3.0


Languages

Language:C++ 100.0%