Show Posts
Pages: [1]
1  Using Arduino / LEDs and Multiplexing / Re: Reversed output on 74hc595 on: December 05, 2012, 09:50:43 am
I don't have a schematic ready but I can show you some pictures:


Okay, it appears you have your logic backwards. You have all your LED anodes wired to +V through a current limiting resistor. Then you are driving the individual cathodes from the output of your shift register. So, if you want to turn on an LED you must write a LOW into the shift register output so that current will flow from +V toward a low voltage(effectively ground). When you write a HIGH into the shift register output, you effectively have +V at both ends of your circuit, and no current flows. Does that make sense?

It absolutely does. Thank you very much. Problem solved.
2  Using Arduino / LEDs and Multiplexing / Re: Reversed output on 74hc595 on: December 05, 2012, 09:08:54 am
Depending how the leds are wired, those pictures can be total correct.

If you don't want to reverse your data being sent, just reverse how the leds are wired: if they are wired to ground now; wire them to Vcc; if they are wired to Vcc, wire them to ground.


Damn, I totally see your point. thanks a million. I had to be much more careful.
3  Using Arduino / LEDs and Multiplexing / Re: Reversed output on 74hc595 on: December 05, 2012, 08:59:08 am
Quote
digitalWrite(pShift, LOW);
  digitalWrite(pData, HIGH);
  digitalWrite(pShift, HIGH);

You have just loaded '1' into the shift register.


And that is supposed to light up the first led, right? In my case it does the opposite.
4  Using Arduino / LEDs and Multiplexing / Re: Reversed output on 74hc595 on: December 05, 2012, 08:57:44 am
I don't have a schematic ready but I can show you some pictures:
5  Using Arduino / LEDs and Multiplexing / Reversed output on 74hc595 on: December 05, 2012, 08:27:08 am
I am a beginner at electronics. I was trying to light up 8 leds using a 74hc595. I did all the cabling and programming but faced a very unexpected result. When I upload a high bit to the register, it outputs a low bit, and vice versa. So when I want to light up all 8 leds, they all get dark. If I try to to get them all dark, then they altogether light up. Here is my code for lighting them up one by one (This actually makes them all dark one by one):

Code:

int pData = 2;
int pShift = 3;
int pLatch = 4;

void setup()
{
  pinMode(pData, OUTPUT);
  pinMode(pShift, OUTPUT);
  pinMode(pLatch, OUTPUT);
}

void loop()
{
 
  digitalWrite(pLatch, LOW);

  digitalWrite(pShift, LOW);
  digitalWrite(pData, HIGH);
  digitalWrite(pShift, HIGH);
 
  digitalWrite(pLatch, HIGH);

  delay(500);
}

I can of course move on with this reverse logic, uploading high when I need low, etc, but seriously, what is going on here? Any guidance is appreciated.
Pages: [1]