Thursday, October 4, 2012

Hardware = finished; Software = eh...

So I got the inverter chip (TC962EPA) which inverts any input from +3 to +18V and wired it up so it's giving the Saablin board the -12V for the OpAmps....it works great! The ground loop isolator made the sound quiet, and a little hollow, and seemed to miss some lows (although it shouldn't have according to the specs). Rass' Saablin board with the opamps sounds a little hollow, but the lows came back, and overall, it sounds wonderful :)

Rass' website here: http://saablin.net/
Rass' Saablin Balanced Audio circuit board: http://saablin.net/node/10
BatchPCB board for order: https://www.batchpcb.com/product_info.php?products_id=31438&check=04c8d356c127174ce72449dcbc8523ce

I still need to update my entire diagram to replace the dual ground loop isolator & replace it with Rass' Saablin board.

As for the software....it still has the display glitch that flickers "BlueSaab" with "CD1 Play".

// ----------------------------------------------
// SECUDUINO
// http://secuduino.blogspot.com/
// By Igor Real
// 16/05/2011
// 
// Saab CDC Changer Emulator
// http://BlueSaab.blogspot.com/
// By Seth Evans
// 4 Oct 2012
// ----------------------------------------------

#include <CAN.h>

int cdbutton;

void setup() {
  // set up CAN
  CAN.begin(47);  // Saab I-Bus is 47.619kbps
  Serial.begin(115200); 
  cdbutton = 0;
  CAN_TxMsg.header.rtr=0;     // this value never changes
  CAN_TxMsg.header.length=8;  // this value never changes
}

void loop() {
  CDC();
  delay(5);
  if (CAN.CheckNew()) {
    CAN_TxMsg.data[0]++;
    CAN.ReadFromDevice(&CAN_RxMsg);
    //PrintBus();
    if (CAN_RxMsg.id==0x3C0) {
      //CDC();
      //delay(5);
      if (CAN_RxMsg.data[0]==0x80) {
        switch (CAN_RxMsg.data[1]) {
        case 0x24:
          cdbutton = 1;
          Serial.println("CDC");
          break;
        case 0x14:
          cdbutton = 0;    
          Serial.println("Radio");
          break;
          //case default:
        } // end of switch case
        //else if (CAN_RxMsg.data[0]==0x80 && CAN_RxMsg.data[1]==0x14)
      }
    }
  } 
  if (cdbutton==1) {
    //CDC();
    //delay(5);
    iPodOn();
  }
  else {
    iPodOff();
  }
}

void CDC() {
  CAN_TxMsg.id=0x6A2;     // 
  CAN_TxMsg.data[0]=0x32;
  CAN_TxMsg.data[1]=0x00;  
  CAN_TxMsg.data[2]=0x00; 
  CAN_TxMsg.data[3]=0x16; // 
  CAN_TxMsg.data[4]=0x01;
  CAN_TxMsg.data[5]=0x02;
  CAN_TxMsg.data[6]=0x00;
  CAN_TxMsg.data[7]=0x00; // 
  CAN.send(&CAN_TxMsg);
  delay(5);
  
  CAN_TxMsg.id=0x3C8;     // CD Changer
  CAN_TxMsg.data[0]=0xE0;
  CAN_TxMsg.data[1]=0x00;  
  CAN_TxMsg.data[2]=0x3F; 
  CAN_TxMsg.data[3]=0x31; // playing disc 1
  CAN_TxMsg.data[4]=0xFF;
  CAN_TxMsg.data[5]=0xFF;
  CAN_TxMsg.data[6]=0xFF;
  CAN_TxMsg.data[7]=0xD0; // married "OK" code
  CAN.send(&CAN_TxMsg);
}

void iPodOn() {
  CAN_TxMsg.id=0x328;     // SID audio text
  CAN_TxMsg.data[0]=0x42;
  CAN_TxMsg.data[1]=0x96;
  CAN_TxMsg.data[2]=0x02;
  CAN_TxMsg.data[3]=0x42; // B
  CAN_TxMsg.data[4]=0x6C; // l
  CAN_TxMsg.data[5]=0x75; // u
  CAN_TxMsg.data[6]=0x65; // e
  CAN_TxMsg.data[7]=0x53; // S
  CAN.send(&CAN_TxMsg);
  delay(5);

  CAN_TxMsg.data[0]=0x01;
  CAN_TxMsg.data[3]=0x61; // a
  CAN_TxMsg.data[4]=0x61; // a
  CAN_TxMsg.data[5]=0x62; // b
  CAN_TxMsg.data[6]=0x00; // _
  CAN_TxMsg.data[7]=0x00; // _
  CAN.send(&CAN_TxMsg);
  delay(5);

  CAN_TxMsg.data[0]=0x00;
  CAN_TxMsg.data[3]=0x00; // _
  CAN_TxMsg.data[4]=0x00; // _
  CAN_TxMsg.data[5]=0x00; // 
  CAN_TxMsg.data[6]=0x00; // 
  CAN_TxMsg.data[7]=0x00; // 
  CAN.send(&CAN_TxMsg);
  delay(5);

  CAN_TxMsg.id=0x368;     // enable the SID (audio) text?
  CAN_TxMsg.data[0]=0x02;
  CAN_TxMsg.data[1]=0x19;
  CAN_TxMsg.data[2]=0x00;
  CAN_TxMsg.data[3]=0x00;
  CAN_TxMsg.data[4]=0x00;
  CAN_TxMsg.data[5]=0x00;
  CAN_TxMsg.data[6]=0x00;
  CAN_TxMsg.data[7]=0x00;
  CAN.send(&CAN_TxMsg);
  delay(5);
}

void iPodOff() {
  CAN_TxMsg.id=0x368;     // turn off the SID (SPA) text
  CAN_TxMsg.data[0]=0x02;
  CAN_TxMsg.data[1]=0x19;
  CAN_TxMsg.data[2]=0x00;
  CAN_TxMsg.data[3]=0x00;
  CAN_TxMsg.data[4]=0x00;
  CAN_TxMsg.data[5]=0x00;
  CAN_TxMsg.data[6]=0x00;
  CAN_TxMsg.data[7]=0x00;
  CAN.send(&CAN_TxMsg);
  delay(10);
}

void PrintBus() {
  if (CAN_RxMsg.id==0x290) {
    Serial.print(CAN_RxMsg.id,HEX);
    Serial.print(";");
    Serial.print(CAN_RxMsg.data[0],HEX);
    Serial.print(";");
    Serial.print(CAN_RxMsg.data[1],HEX);
    Serial.print(";");
    Serial.print(CAN_RxMsg.data[2],HEX);
    Serial.print(";");
    Serial.print(CAN_RxMsg.data[3],HEX);
    Serial.print(";");
    Serial.print(CAN_RxMsg.data[4],HEX);
    Serial.print(";");
    Serial.print(CAN_RxMsg.data[5],HEX);
    Serial.print(";");
    Serial.print(CAN_RxMsg.data[6],HEX);
    Serial.print(";");
    Serial.println(CAN_RxMsg.data[7],HEX);
  }
}



No comments:

Post a Comment