Heya, I have tried my best, but I cannot interface the SID on my own, so I call you for help: Is there someone who has done this before? I would REALLY appreciate schematics and or code, because this doesn't seem to work (or it's just the hardware...)

Code:
//Define pin names
#define ad4 A0
#define ad3 A1
#define ad2 A2
#define ad1 A3
#define ad0 A4
#define CS  A5
#define D   4
#define Mhz 9
#define CP  6
#define RES 7

//optional input
#define Dcalc 2
#define Ccalc 3

void setup(){
 pinMode(ad0,OUTPUT);
 pinMode(ad1,OUTPUT);
 pinMode(ad2,OUTPUT);
 pinMode(ad3,OUTPUT);
 pinMode(ad4,OUTPUT);
 
 pinMode(CS,OUTPUT);//inverted
 pinMode(D,OUTPUT);
 pinMode(CP,OUTPUT);
 pinMode(RES,OUTPUT);//inverted
 
 pinMode(Dcalc,INPUT);
 pinMode(Ccalc,INPUT);
 
    DDRB = _BV(DDB1);                  //set OC1A/PB1 as output (Arduino pin D9, DIP pin 15)
    TCCR1A = _BV(COM1A0);              //toggle OC1A on compare match
    OCR1A = 7;                         //top value for counter
    TCCR1B = _BV(WGM12) | _BV(CS10);   //CTC mode, prescaler clock/1
 delay(5);
 //Set all inverted pins
 digitalWrite(CS,HIGH);
 digitalWrite(RES,HIGH);
 
 //Clear the SID's registers
 digitalWrite(RES,LOW);
 delay(2);//Make sure they're empty
 digitalWrite(RES,HIGH);
 Serial.begin(9600);
 //Default Preset
 regWrite(0x00,0xC7);//Test tone C3 (Least-significant)
 regWrite(0x01,0x84);//             (Most-significant)
 regWrite(0x02,0x50);//Pulsewidth   (Least-significant)
 regWrite(0x03,0x01);//             (Most-significant)
 regWrite(0x04,B01000001);//Gate,Square
 regWrite(0x05,0xA8);//Attack,Decay
 regWrite(0x06,0xA9);//Sustain,Release
}

void loop(){
  regWrite(0x04,B01000001);//Gate,Square
  delay(500);
  regWrite(0x04,B00100000);//Gate=0,Saw
  delay(500);
}

void regWrite(int address, int data){
   digitalWrite(ad0,bitRead(address,0));
   digitalWrite(ad1,bitRead(address,1));
   digitalWrite(ad2,bitRead(address,2));
   digitalWrite(ad3,bitRead(address,3));
   digitalWrite(ad4,bitRead(address,4));
   for(int i=0;i<=7;i+=1){
    digitalWrite(D,bitRead(address,i));
    digitalWrite(CP,HIGH);
    delayMicroseconds(10);
    digitalWrite(CP,LOW);
    delayMicroseconds(10);
   }
   digitalWrite(CS,LOW);//CS is inverted
   delayMicroseconds(10);
   digitalWrite(CS,HIGH);
}



Hardware:
Arduino connected to an 8bit shiftregister which is connected to the data input of the SID. The adress input of the SID is connected to the analog pins of the arduino (I use them as regular I/O) The 1Mhz clock signal is generated by the arduino (I hope)
Did you intentionally not turn on the pull-up resistors for the input pins? Is that important to your application? delay() is a very bad thing to use, by the way.
Why should I do that? I don't use the input anyway. Also: What's wrong with delay()? I've never had trouble with it. It's now just sitting there for test purposes. I just want to get some noise out of the SID chip, but it just doesn't seem to work.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement