addisonElliott
Newbie level 6
- Joined
- Apr 1, 2013
- Messages
- 11
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,395
Hello, I am working on a LED matrix and I ordered some shift registers to use. I have never used them before so I just set them up on a test circuit with four output LEDs just to get a feel of what programming will be needed to use this thing. Long story short, I tried every possible outcome and I don't get any response from the shift register. They are from China on ebay. I actually got a refund from the first batch and ordered another from the same seller to see if it was just that; the results were the same each time. The guy just gets it from a supplier in China, but I am starting to think they are bad.
I would just like a confirmation that I am doing it right since I have never used these. For all I know, I could be doing something wrong. Here's the setup I have:
All three GNDs are connected to a ground, and the VCC is connected.
SER IN is connected to D0
SRCK is connected to D1
RCK is connected to D2
ENABLE is connected to D3
SRCLR is connected to D4
This is my code:
I would just like a confirmation that I am doing it right since I have never used these. For all I know, I could be doing something wrong. Here's the setup I have:
All three GNDs are connected to a ground, and the VCC is connected.
SER IN is connected to D0
SRCK is connected to D1
RCK is connected to D2
ENABLE is connected to D3
SRCLR is connected to D4
This is my code:
Code:
int main(void)
{
/*
D0 - SER IN
D1 - SRCK
D2 - RCK
D3 - ENABLE
D4 - SRCLR
*/
DDRD = 0b00011111;
PORTD = (1 << 4);
uint8_t i;
for (i = 0; i < 7; ++i)
{
PORTD |= (1 << 0);
PORTD |= (1 << 1); // SRCK high
_delay_ms(1);
PORTD &= ~(1 << 1); // SRCK low
}
PORTD |= (1 << 2); // RCK high
_delay_ms(1000);
PORTD &= ~(1 << 2); // RCK low
return 0;
}