How to Controll Nuvoton ISD1760 Chip?

hii thanku fr ur code..well i am trying to record through analog pin.and i could successfully record the noise. now i want to record a analog waveform out from dac 0808.so i had interfaced arduino uno with isd 1760 and dac 0808. in the code when record command  is given the output from portD is given to dac input pins parallely. output of dac0808 is connected to analog pin of isd 1760. so wen isd 1760 goes in record mode it will have analog signal at its input.but in the serial monitor only starting,power up and cl is displayed. instead of cl it shud be displayed as clear interrupt end.and after giving record command its not recording!!.plz someone guide me on where i m going wrong.or if someone has any other idea. here is ma code: 
[//define pins
#define DATAOUT     11   //mosi
#define DATAIN 12   //miso
#define SPICLOCK    13   //sck
#define SLAVESELECT 10   //ss

//opcodes
#define PU    0x01
#define STOP  0x02
#define RESET 0x03
#define CLR_INT     0x04
#define RD_STATUS   0x05
#define RD_PLAY_PTR 0x06
#define PD    0x07
#define RD_REC_PTR  0x08
#define DEVID 0x09
#define PLAY  0x40
#define REC   0x41
#define REC_LED   0x51//record with LED on
#define ERASE 0x42
#define G_ERASE     0x43
#define RD_APC 0x44
#define WR_APC1     0x45
#define WR_APC2     0x65
#define WR_NVCFG    0x46
#define LD_NVCFG    0x47
#define FWD   0x48
#define CHK_MEM     0x49
#define EXTCLK 0x4A
#define SET_PLAY    0x80
#define SET_REC     0x81
#define SET_REC_LED    0x91//set record with LED on
#define SET_ERASE   0x82

#define WAIT_TIME 10//waiting time (ms) after SS=LOW at least 500ns
#define WAIT_TIME2 100

int start_adress = 0x010;//test address to record
int end_adress = 0x024;//20unit
byte sine[] = {127, 134, 142, 150, 158, 166, 173, 181, 188, 195, 201, 207, 213, 219, 224, 229, 234, 238, 241, 245, 247, 250, 251, 252, 253, 254, 253, 252, 251, 250, 247, 245, 241, 238, 234, 229, 224, 219, 213, 207, 201, 195, 188, 181, 173, 166, 158, 150, 142, 134, 127, 119, 111, 103, 95, 87, 80, 72, 65, 58, 52, 46, 40, 34, 29, 24, 19, 15, 12, 8, 6, 3, 2, 1, 0, 0, 0, 1, 2, 3, 6, 8, 12, 15, 19, 24, 29, 34, 40, 46, 52, 58, 65, 72, 80, 87, 95, 103, 111, 119,};

byte index = 0;//index variable for extracting data from array "sine"


 
  
void setup() {
  if (index==100)
  {
    //reset index if it reaches 100
    index=0;
  }
  
  pinMode(DATAOUT, OUTPUT);
  pinMode(DATAIN, INPUT);
  pinMode(SPICLOCK, OUTPUT);
  pinMode(SLAVESELECT, OUTPUT);
  
    initialize();
  for (byte i=0;i<8;i++)
  {
    pinMode(i, OUTPUT);//set digital pins 0-7 as outputs
   }
 cli();//stop interrupts

  //set timer1 interrupt at ~44.1kHz
  TCCR1A = 0;// set entire TCCR1A register to 0
  TCCR1B = 0;// same for TCCR1B
  TCNT1  = 0;//initialize counter value to 0
  // set compare match register for 1hz increments
  OCR1A = 361;// = (16*10^6) / (44100*1) - 1 (must be <65536)
  // turn on CTC mode
  TCCR1B |= (1 << WGM12);
  // Set CS10 bit for 1 prescaler
  TCCR1B |= (1 << CS10);  
  // enable timer compare interrupt
  TIMSK1 |= (1 << OCIE1A);
  
}

void initialize()
{
   byte clr;
    
  digitalWrite(SLAVESELECT, HIGH); //disable device
  digitalWrite(SPICLOCK, HIGH); //SCLK
  digitalWrite(DATAOUT, LOW); //MOSI
  
  SPCR = B01111111; //data lsb, clock high when idle, samples on falling
  clr = SPSR;
  clr = SPDR;
  delay(10);

  //start serial
  Serial.begin(9600);
  Serial.println("Sketch is starting up");

  pu();
  clear_int();
}
void loop() 
{
    char c;
     if(Serial.available())
    {
       c = Serial.read();
      switch(c)
      {
         case '0':
           initialize();
           break;
         
         case '2':
           set_rec(start_adress, end_adress);
           
           break;
         case '3':
           set_play(start_adress, end_adress);
           
           break;
         case 'k':
           clear_int();
           break;
         
         case 'z':
           eraseAll();
         break;
         
        
         case 'p':
           stop();
           break;
         case 's':
           reset();
           break;
         case 'a':
           write_apc(true, false, 7);//mic in & no moniter on recording
           break;
         case 'b':
           write_apc(false, false, 7);//analog in & no moniter on recording
           break;
         case 'c':
           Serial.println(read_apc(), BIN);//read apc
         break;  
         case 'd':
           Serial.println(read_status(), BIN);//read status
      }
    }
}
    void pu()   //power up
{
  digitalWrite(SLAVESELECT, LOW);
  delay(WAIT_TIME);
  spi_transfer(PU); // power up
  spi_transfer(0x00); // data byte
  digitalWrite(SLAVESELECT, HIGH);
  delay(WAIT_TIME2);
  
  Serial.println("power up end");
}

void clear_int()// clear interupt
{
   digitalWrite(SLAVESELECT, LOW);
   delay(WAIT_TIME);
   spi_transfer(CLR_INT); // clear interupt and eom bit
   spi_transfer(0x00); // data byte
   digitalWrite(SLAVESELECT, HIGH);
   delay(WAIT_TIME2);
   Serial.println("clear int end");
}
void reset()// reset
{
  digitalWrite(SLAVESELECT, LOW);
  delay(WAIT_TIME);
  spi_transfer(RESET); // resett
  spi_transfer(0x00); // data byte
  digitalWrite(SLAVESELECT, HIGH);
  delay(WAIT_TIME2);
  
  Serial.println("reset end");
}
void stop()
{
  digitalWrite(SLAVESELECT, LOW);
  delay(WAIT_TIME);
  spi_transfer(STOP); // stop
  spi_transfer(0x00); // data byte
  digitalWrite(SLAVESELECT, HIGH);
  delay(WAIT_TIME2);
  
  Serial.println("stop end");
}
void set_play(int starta, int enda)
{
  digitalWrite(SLAVESELECT, LOW);
  delay(WAIT_TIME);
  spi_transfer(SET_PLAY); // set play
  spi_transfer(0); // data byte

  spi_transfer(starta & 255); // data byte start
  spi_transfer(starta >> 8); // data byte last 3 bits
  spi_transfer(enda & 255); // data byte stop
  spi_transfer(enda >> 8); // data byte last 3 bits
  spi_transfer(0); // data byte blank
  digitalWrite(SLAVESELECT, HIGH);  
  delay(WAIT_TIME2);
  
  Serial.println("set play end");
}

void set_rec(int starta, int enda)
{
  digitalWrite(SLAVESELECT, LOW);
  delay(WAIT_TIME);
    sei();//enable interrupts
spi_transfer(SET_REC); // clear interupt and eom bit
  //spi_transfer(SET_REC_LED);//set record with LED on
  spi_transfer(0); // data byte

  spi_transfer(starta & 255); // data byte start
  spi_transfer(starta >> 8); // data byte last 3 bits
  spi_transfer(enda & 255); // data byte stop
  spi_transfer(enda >> 8); // data byte last 3 bits
  spi_transfer(0); // data byte blank
    digitalWrite(SLAVESELECT, HIGH);   
  delay(WAIT_TIME2); 
  Serial.println("set rec end");
  PORTD = sine[index];//send a value stored in the array sine out to the DAC through digital pins 0-7
  index++;//increment index by one
   
}


void eraseAll()
{
  digitalWrite(SLAVESELECT, LOW);
  delay(WAIT_TIME);
  spi_transfer(G_ERASE);// g_erase 
  spi_transfer(0x00); // data byte
  digitalWrite(SLAVESELECT, HIGH);
  delay(WAIT_TIME2);
  
  Serial.println("erase all end");
}
char spi_transfer(volatile char data)
{
  SPDR = data;           // Start the transmission
  while (!(SPSR & (1 << SPIF)))     // Wait for the end of the transmission
  {
  };
  return SPDR;           // return the received byte
} 
 void write_apc(boolean flag, boolean flag2, int vol)
{
    uint16_t d[12];
    for(int i = 0; i < 12; i++)
    {
      d[i] = 0x00;
    }
    d[3] = 0x01;
    d[6] = 0x00;
    uint16_t apc =  (d[0] | d[1] << 1 | d[2] << 2 | d[3] << 3 | d[4] << 4 | d[5] << 5 | d[6] << 6 | d[7] << 7 | d[8] << 8 | d[9] << 9 | d[10] << 10 | d[11] << 11);
      
    digitalWrite(SLAVESELECT, LOW);
    delay(WAIT_TIME);
    spi_transfer(WR_APC2); // write apc register 2
    spi_transfer(apc & 0xFF); // data byte start
    spi_transfer(apc >>8) ; // data byte last 3 bits
 
    digitalWrite(SLAVESELECT, HIGH);
    
    delay(WAIT_TIME2);
    
    Serial.println("write apc end");
}

uint16_t read_apc()
{
  uint16_t apc;
  uint8_t data[4] = {0xFF,0xFF,0xFF,0xFF};
  
  digitalWrite(SLAVESELECT, LOW);
  delay(WAIT_TIME);
  data[0] = spi_transfer(RD_APC); // read apc register
  data[1] = spi_transfer(0);
  data[2] = spi_transfer(0);
  data[3] = spi_transfer(0);
  digitalWrite(SLAVESELECT, HIGH);
  
  delay(WAIT_TIME2);
  
  apc = word(data[3], data[2]);
  
  Serial.println("read apc end");
  
  return apc;
}

uint16_t read_status(void)
{
  uint16_t sr1;
  uint8_t data[3] = {0xFF,0xFF,0xFF};
  
  digitalWrite(SLAVESELECT, LOW);
  delay(WAIT_TIME);
  data[0] = spi_transfer(RD_STATUS); // read status register
  data[1] = spi_transfer(0);
  data[2] = spi_transfer(0);
  digitalWrite(SLAVESELECT, HIGH);
  
  delay(WAIT_TIME2);
  
  sr1 = word(data[2], 0xFF);
  return sr1;
}

      
      /code]

[/quote]

i m givin input to isd1760 through its analog pin from dac0808 output pin. i have interfaced dac0808 and isd1760 to arduino uno board. the code is getting compiled but in the serial monitor i m just gettin startup, power up message correctly and "cl" instead of "clear interrupt end". and after giving command of set_rec i m supposed to get "set rec end". i m not getting that. and the ic is not recording. i am giving data bytes to dac to give sine wave. when i m giving record command,arduino wil also start giving input to dac.so wen isd goes in record mode it will have output from dac as sine wave at its analog input. but this is not working. can somebody plzz let me kno wher i m goin wrong?or if anybody has any idea regarding my problem.

Please, don't cross-post. Please, don't resume very old thread, noone will help you in those threads. Please, include the code inside the proper tags.