This is my first post so sorry if I don't give all the information you need. Be free to ask anything you need.
I am using Arduino to control a 32 channel mux, the HV2801. I have read the other two posts in this forum about this IC, but I have a problem. I'm trying to control two of these ICs, but the Latch Enable is not working. Both of the ICs activate the same switches, so I can't activate the switch 1 in one IC and the switch 2 in the other IC.
Here is the code I am using:
#include <SPI.h>
const int CLR1=7;
const int LE1 =2;
const int CLR2= 8;
const int LE2 =4;
const int DIN =11; // Data in logic input
const int CLK =13; // Clock logic input for Shift register
void setup() {
pinMode(LE1, OUTPUT);
pinMode(CLR1, OUTPUT);
digitalWrite(CLR1, HIGH);
pinMode(LE2, OUTPUT);
pinMode(CLR2, OUTPUT);
digitalWrite(CLR2, HIGH);
delay(100);
digitalWrite(CLR1, LOW);
digitalWrite(CLR2, LOW);
digitalWrite(LE1, HIGH);
digitalWrite(LE2, HIGH);
delay(100);
SPI.begin();
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE3);
delay(100);
SPI.transfer(B10000000);
SPI.transfer(B00000000);
SPI.transfer(B00000000);
SPI.transfer(B00000000);
delay(100);
digitalWrite(LE1, LOW);
delay(100);
digitalWrite(LE1, HIGH);
delay(100);
SPI.transfer(B00000000);
SPI.transfer(B00000000);
SPI.transfer(B00000000);
SPI.transfer(B00000001);
delay(100);
digitalWrite(LE2, LOW);
delay(100);
digitalWrite(LE2, HIGH);
delay(100);
}
void loop() {
}
Here I want the first IC to turn on the first switch and the second IC to turn on the last switch, but both of them activate the last switch. They just do the last information sent.
But DOUT is HIGH only when data in register 31 is HIGH. Anyway, I have the ICs soldered to a PCB and it has no pin for DOUT. I tried letting LE always be HIGH so the IC wouldn't change its state, but it does anyway.
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
It only takes a 12ns pulse to activate LE.
I suspect that you have some coupling between LE1 and LE2 on your PCB and when you activate one it causes a glitch on the other.
You can test my hypothesis by holding CLR HIGH on IC2 while writing data to IC1 and vise versa and see if the correct data is being sent to the selected IC
So it worked, I don't know why but it works. I tried what jim-p said and it did what he said, and when I tried the original code again it worked.
I have to say that when I take some measures with the multimeter, the IC bugs and does the same I've been talking about. But I restart the Arduino and it works.