- Soundchip for calculators - arduino based
- 15 Jan 2013 01:43:30 pm
- Last edited by keoni29 on 23 Dec 2013 07:09:00 am; edited 3 times in total
Edit: New video
Old news and old sourcecode!
Old picture, yet gives a good overview of the hardware.
Newer picture with the on off switch, midi connector and jumper settings for midi/sid mode selection.
This is an atmega microprocessor emulating a SID soundchip. (found in old c64 homecomputers) I used a library for the emulation and I wrote my own link protocol. The calculator shifts out the data and the arduino code processes it. This thing works with everything with two free GPIO pins. The link protocol is pretty simple to implement. I designed it with the TI84+ in mind, but you can hook it up to any calc with a bidirectional open-drain linkport. I programmed the link protocol in AXE.
Code:
And this is the code running on the arduino:
(note: get the lib as well http://code.google.com/p/sid-arduino-lib/ )
I removed the midi functionality for now, but it will be back soon.
Faster optimized code for the arduino:
Code:
Hardware:
The tip of the 2,5mm plug is connected to arduino pin 2 (DIP pin 4) and the ring is connected to arduino pin 3 (DIP pin 5.) Remember that the pinout of the arduino is not the same as the microcontroller. Check the pinouts before you build this.
Pin 9 (DIP pin 15) is the audio output.
Old news and old sourcecode!
Old picture, yet gives a good overview of the hardware.
Newer picture with the on off switch, midi connector and jumper settings for midi/sid mode selection.
This is an atmega microprocessor emulating a SID soundchip. (found in old c64 homecomputers) I used a library for the emulation and I wrote my own link protocol. The calculator shifts out the data and the arduino code processes it. This thing works with everything with two free GPIO pins. The link protocol is pretty simple to implement. I designed it with the TI84+ in mind, but you can hook it up to any calc with a bidirectional open-drain linkport. I programmed the link protocol in AXE.
Code:
.send
lbl s
0->port
pause 1
for(b,0,7
if r1^2
3->port
else
2->port
end
pause 1
0->port
pause 1
r1/2->r1
And this is the code running on the arduino:
(note: get the lib as well http://code.google.com/p/sid-arduino-lib/ )
I removed the midi functionality for now, but it will be back soon.
Faster optimized code for the arduino:
Code:
#include <SID.h>
// MACROs
#define PIN2H (PIND & 0B00000100)
#define PIN3L !(PIND & 0B00001000)
#define CLR(x,y) (x&=(~(1<<y)))
#define SET(x,y) (x|=(1<<y))
SID mySid;
void setup()
{
pinMode(2,INPUT);
pinMode(3,INPUT);
mySid.begin();
}
int n=0;
int timer=0;
int count=0;
int dcount=0;
byte get=B00000000;
int addrval[3] = {0,0,0};
#define CHANNEL1 0
#define CHANNEL2 7
#define CHANNEL3 14
void loop()
{
do{
do
{
if (PIN3L)
{
if (PIN2H)
{
CLR(get,count);
}
else
{
SET(get,count);
}
count++;
while(PIN3L)
{
timer++;
if (timer==500){
n=count=0;
break;
}
}
timer=0;
}
}while(count!=8);
addrval[n]=get;
n++;
count=0;
}while(n!=2);
mySid.set_register(addrval[0], addrval[1]);
n=0;
}
Hardware:
The tip of the 2,5mm plug is connected to arduino pin 2 (DIP pin 4) and the ring is connected to arduino pin 3 (DIP pin 5.) Remember that the pinout of the arduino is not the same as the microcontroller. Check the pinouts before you build this.
Pin 9 (DIP pin 15) is the audio output.