How to Controll Nuvoton ISD1760 Chip?

bradski58:
I know this is an old thread but thought I'd share my experience... in case anyone is considering using the ISD17xx.
...

Couldn't have put it better myself, so I didn't. :wink:

I posted on "programming questions" as it was sorta a compiler thing of general interest maybe, but my point can be reiterated harmlessly here I hope.

BTW I love and approve of hijacking buttons if it can do what you need. But I think the fear people might have of SPI should be overcome.

The "ready_play_wait()" routine from above is flawed. It has a certain chance of failing to wait at all. byte3 is tested before it is received from the chip. All you needa do is change the while to a do/while.

I think this might have caused some heads to ache.

Here's a general ready_wait that works. No need for any delay(), but it does just waste time waiting.

void ready_wait()
{
  int counter;
  byte byte3;
 
  counter = 0;
  do {
    counter++;
    digitalWrite(SLAVESELECT, LOW);
    spi_transfer(RD_STATUS);
    spi_transfer(0x00);
    byte3 = spi_transfer(0x00);
    digitalWrite(SLAVESELECT, HIGH);
  } while (byte3 << 7 != 128);

//  Serial.println(counter);
//  delay(100);
}

alto777