Tuesday, February 22, 2011
Arduino SIDshield initial schematic and code
I still haven't gotten around adding the 5V-to-12V boost circuit. I was planning on using the LT1109CZ-12 - a nice, small TO-92 packaged chip. Unfortunately it's not easy to get, it seems. My 6581 draws 27mA from the 12V supply, well within the limits promised bu Commodore (datasheet says 25mA typ, 40mA max).
The library to drive the chip is a modification of the Spi library, reduced to the constructor and a single function. I will add more functions later, for now all it does is take an address and data value and set the appropriate SID register. This first version is on my website. A simple sketch to test it:
sid.setReg(24,15); // full volume
sid.setReg(6,0xf0); // ADSR=0,0,15,0
sid.setReg(1,0x1c); // set frequency to 440Hz
// .8s beep at 1s interval
sid.setReg(4,17); // gate on
sid.setReg(4,16); // gate off
The speed with which registers are written is pretty good. I don't want to make it any shorter actually, since the chip select is not synchronized to the clock signal - so I have to make sure a few cycles happen during CS low. The shift registers get loaded within 5us, and the CS signal is asserted for slightly less than that. Overall the entire operation of setReg is about 15us.
More to come.
UPDATE: see here.