Author Topic: TI84+ soundchip - arduino SID emulator  (Read 40623 times)

0 Members and 1 Guest are viewing this topic.

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
TI84+ soundchip - arduino SID emulator
« on: January 14, 2013, 01:20:26 pm »


I finally made this! It's a breadboard arduino running a sid emulator and a link protocol. You can write to registers in the emulated SID chip. It's very user friendly. Now it's possible to have ingame music and soundeffects without terrible framerate drops.

I need to clean up the source, so that's up for download tomorrow.

Spoiler For Spoiler:
Code: [Select]
#include <SID.h>

#define SOUND 1
#define MIDI 0

// 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;
}


« Last Edit: January 20, 2013, 09:36:17 am by Keoni29 »
If you like my work: why not give me an internet?








Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: TI84+ soundchip - arduino SID emulator
« Reply #1 on: January 14, 2013, 02:01:58 pm »
Nifty ;)

Relayed to the French community: http://tiplanet.org/forum/viewtopic.php?t=11111
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: TI84+ soundchip - arduino SID emulator
« Reply #2 on: January 14, 2013, 02:05:14 pm »
Thank you for translating :)
If you like my work: why not give me an internet?








Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: TI84+ soundchip - arduino SID emulator
« Reply #3 on: January 14, 2013, 02:12:44 pm »
You're welcome ;)
The posts will be updated on the TI-Planet side when you have posted the source code, the binaries, breadboard schematics, and whatever else.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: TI84+ soundchip - arduino SID emulator
« Reply #4 on: January 14, 2013, 02:14:27 pm »
The breadboard schematic is just a breadboarded arduino. You can use a stock arduino and hook up pin 9 to a set of speakers or headphones.
If you like my work: why not give me an internet?








Offline SpiroH

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +153/-23
    • View Profile
Re: TI84+ soundchip - arduino SID emulator
« Reply #5 on: January 14, 2013, 03:54:19 pm »
It's a quite nice idea, i like it! I would suggest you find (make) a small-pcb board + perhaps a phone loudspeaker, so that it would be possible to sorta of glue it to the calculator's back, making more portable. Just an idea. :)

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: TI84+ soundchip - arduino SID emulator
« Reply #6 on: January 14, 2013, 04:09:50 pm »
Ninja'd you. I already made it :D
If you like my work: why not give me an internet?








Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: TI84+ soundchip - arduino SID emulator
« Reply #7 on: January 14, 2013, 10:55:26 pm »
Pretty cool Keoni! ^^
« Last Edit: January 14, 2013, 10:55:40 pm by Art_of_camelot »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: TI84+ soundchip - arduino SID emulator
« Reply #8 on: January 14, 2013, 11:15:51 pm »
Nice! Now just build it INSIDE of a calculator :P

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Ranman

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1354
  • Rating: +83/-0
    • View Profile
Re: TI84+ soundchip - arduino SID emulator
« Reply #9 on: January 15, 2013, 02:14:26 am »
Awesome work!

There is as special place in my heart for the C64 and its SID chip!
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: TI84+ soundchip - arduino SID emulator
« Reply #10 on: January 15, 2013, 04:56:37 am »
Nice! Now just build it INSIDE of a calculator
That's the next step. First I want to make sure it's flawless. I will also add the original midi out code to the chip. This project was based around the code of my midi interface.

Edit: The midi feature is now implemented. I can now send midi messages as long as they are 3 bytes in size. With a jumper setting I can set the soundchip to SID or MIDI mode.
« Last Edit: January 15, 2013, 08:01:49 am by Keoni29 »
If you like my work: why not give me an internet?








Offline Ranman

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1354
  • Rating: +83/-0
    • View Profile
Re: TI84+ soundchip - arduino SID emulator
« Reply #11 on: January 15, 2013, 08:34:58 am »
« Last Edit: January 15, 2013, 08:39:03 am by Ranman »
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Offline SpiroH

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +153/-23
    • View Profile
Re: TI84+ soundchip - arduino SID emulator
« Reply #12 on: January 15, 2013, 10:09:40 am »
Ninja'd you. I already made it :D
You should show it off then to give it a bit of spice...
Can you do the same trick to ti-nspire?

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: TI84+ soundchip - arduino SID emulator
« Reply #13 on: January 15, 2013, 10:49:08 am »
I do not own a nspire, but if it has two I/O lines to work with I can easily implement it. I just shift out the data from the calculator with one data line and one clock line.

Without the midi function. Old picture, but shows the size of the board


With the midi connector and an on/off switch. It runs off the calculators batteries. An atmega MCU runs fine on 4v-5v, but 6v will damage it. I added a diode to lower the voltage a bit.


There you have it! It's almost what I had in mind for my profile essay: TI-nterface. I can still add code for GPIO (changing the state of the I/O pins).

If you like my work: why not give me an internet?








Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: TI84+ soundchip - arduino SID emulator
« Reply #14 on: January 15, 2013, 12:25:39 pm »
How long does it take to send such a command to the chip?
it looks great, and sounds even better :)

And sure you have to add gpio support, it's a wast of pins if you don't do so, or use an ATtiny45 or something equivalent. Those are arduino compatible, and are about a third of the size of the atmega328p.

It looks like that midi port is big to get it into a box, how are you gonna solve that? keep it outside?