One thing that's jumping out at me is that you have to clock in 35 bits even though your package does not have that many LEDs. You aren't clocking all those bits in.
Alittle odd but should be fixed now.
Also, the chip SINKS current, so connect your LED anode to 5v and cathode to the chip's pin. In your schematic the LED is backwards and connected to GND.
I changed the LED correctly. This is alittle annoying though.
Finally, the M5450 is a constant current driver. So actually you DON'T need a resistor (ironic given your sig :-)!!).
I'd rather keep it just in case.
I changed the LED wiring, wired out 3 LEDS and changed the code as follows:
#define F_CPU 128000
#include <util/delay.h>
#include <avr/io.h>
#include <inttypes.h>
#define SCK _BV(PB4)
void shreg(uint32_t a){
int z;
//Start sequence ? Is this necessary and correct?
PORTB = 0; // All pins low
_delay_ms(1);
PORTB |= SCK; //SCK high
_delay_ms(1);
PORTB &= SCK; //SCK low
_delay_ms(1);
PORTB |= _BV(PB3); //Serial data high
_delay_ms(1);
PORTB |= SCK; //Sck high
_delay_ms(1);
PORTB &= SCK; //SCK LOW
_delay_ms(1);
for(z = 0;z<35;z++){
if(z < 14){
PORTB = (_BV(PB3) * !!(a&(z<<1))); //Output bit if < 14
} else {
PORTB = 0; //Otherwise output nothing
}
_delay_ms(1);
PORTB |= _BV(PB4); //SCK high
_delay_ms(1);
PORTB &= _BV(PB4); //SCK low
_delay_ms(1);
PORTB = 0; //All pins off
_delay_ms(1);
}
}
int main(){
DDRB = _BV(PB3) | _BV(PB4);
PORTB = 0;
while(1)
shreg(0x0);
}
Problem is all the LEDS always light up regardless of the value I pass to shreg().
Thanks for the help.
I am alittle confused by the code at this point.
I also grounded data enable.