AD75019 Matrix Control

Hello,

i like to know how i can switch off just only 1 selected channel;

example;

Disconnect (1,1);

The code below is working fine, i can select any port to route but not deselect a port.
the code i have found here http://www.dorkbotpdx.org/blog/paul/ad75019_crosspoint_analog_switch#comment-933

any help wil be appriciate.
thanks

#define SIN_PIN 12
#define SCLK_PIN  13

uint8_t update_required = 0;
uint16_t switches[48]; 

void setup()
{
  pinMode(SCLK_PIN, OUTPUT);
  pinMode(SIN_PIN, OUTPUT);

}
void loop()
{
  connect (12, 0);    // Matrix (Input,Output)

  update ();
  update_required = 0;
  exit(0);
}

void connect(uint8_t signal, uint8_t pin)           // function writes a single bit to connect any of the 16 Y pins to any of the 48 X pins.
{
  uint8_t chip;
  if (pin < 16) chip = 32;
  else if (pin < 32) chip = 16;
  else if (pin < 48) chip = 0;
  else return;
  if (signal >= 16) return;
  switches[chip + (15 - signal)] |= (1 << (pin & 15));
  update_required = 1;
}

void disconnectAll(void)                            // function clears the entire in-memory array
{
  memset(switches, 0, sizeof(switches));
  update_required = 1;
}

void update(void)                                   // writes all the bits to all 3 chips and pulses the latch clock, so all the switches change at the same moment.
{
  uint8_t i;
  uint16_t n, mask;

  for (i = 0; i < 48; i++) {
    n = switches[i];
    for (mask = 0x8000; mask; mask >>= 1) {
      digitalWrite(SIN_PIN, (n & mask) ? HIGH : LOW);  // SDI_PIN
      // 20ns setup required
      asm("nop");
      asm("nop");
      digitalWrite(SCLK_PIN, HIGH);
      asm("nop"); // sclk pulse width, 100 ns minimum
      asm("nop");
      asm("nop");
      asm("nop");
      asm("nop");
      asm("nop");
      digitalWrite(SCLK_PIN, LOW);
      asm("nop");
      // 40ns hold time required
    }
  }
  asm("nop"); // 65ns setup required
  asm("nop");
  asm("nop");
  asm("nop");
  update_required = 0;
}

anyone can help me ?

  exit(0);

Why?

I'm not sure what selecting, or de-selecting, a port means, in terms of the code you posted.

Hi PaulS,

Thanks for the replay.

Here i route Input 1 to Output 1 to switch on in the matrix

connect (1, 1);    // Matrix (Input, to Output)

  update ();
  update_required = 0;
  exit(0);

The problem is how to switch off just 1 output?

Here i route Input 1 to Output 1 to switch on in the matrix

I don't understand that statement.

The connect() function takes two values, and uses them to determine a value to place in an array, and where to place that value.

It is simple enough to print the index that is computed, and the value that is placed in the array at that index, to see what effect the values passed to the array are.

The update() method takes the data in the array and sends it to the device. I think the comment about connecting two pins together is misleading, but I'd need to print the values (index and value) that are generated in the connect() function, as well as the input to the function, to really understand what the function is doing.

Hi PaulS,

Maybe this is the right info for u:

1,
The chip is controlled by a big 256 bit shift register. I just chained the 3 chips in tandem, so the shift register is 768 bits.

In the regression tester, I used 3 of these chips to allow any combination of the 48 signals (on the X pins) to connect to any of 16 signals (on the Y pins). The 16 Y pins are connected as a 16 bit bus between these 3 chips, and the sets of 3 chips on the other boards in the tester. This “anything to the 16 signal bus” approach is important for understanging the code.

2,
The first bit loaded via SIN, the serial data input, controls the switch
at the intersection of row Y15 and column X15. The next bits control the
remaining columns (down to X0) of row Y15, and are followed by the bits
for row Y14, and so on down to the data for the switch at the intersec-
tion of row Y0 and column X0. The shift register is dynamic, so
there is a minimum clock rate, specified as 20 kHz.

3,
This code works with a copy of all 768 bits in memory. The disconnectAll() function clears the entire in-memory array, and the connect() function writes a single bit to connect any of the 48 X pins to any of the 16 Y pins.

Those functions only modify the in-memory array. To actually update the AD75019 chips, the update() function is used. It writes all the bits to all 3 chips and pulses the latch clock, so all the switches change at the same moment.

AD75019JP.pdf (72 KB)

The disconnectAll() function clears the entire in-memory array

Read that sentence a couple of times. Does the name of function make ANY sense?

Hi PaulS

Thanks for the response.

yes, i have read that also.

i have tried this in many combinations:

        disconnectAll (0, 0);           // disconnect audio from input 1 , output 1
        update ();
        update_required = 0;

it's not working. Fault message: too many arguments to function 'void disconnectAll()'

Any Idee ?

Midway: Any Idee ?

No. You seem to have simply chosen function names at random. The disconnectAll() function might just as well be called SamIsAWelshCorgie() for all the name tells us about what the function actually does.

Clearly, you can not pass arguments to a function that takes no arguments.

Some meaningful names for functions seems to be the first order of business.