Shift registers working in paralel
i've tried figuring out how send bit of information along 2 shift registers atemps failed. seems second register works in paralel first 1 one bit delay. here's code:
code: [select]
int latchpin = 10;
int clockpin = 12;
int datapin = 11;
void setup()
{
pinmode(latchpin, output);
pinmode(clockpin, output);
pinmode(datapin, output);
}
void loop()
{
int i;
for(i=0; i<8;i++)
{
digitalwrite(latchpin, low);
shiftout(datapin, clockpin, lsbfirst, b00000001 << i);
digitalwrite(latchpin, high);
delay(125);
}
for(i=0; i<8;i++)
{
digitalwrite(latchpin, low);
shiftout(datapin, clockpin, lsbfirst, b00000000 << i);
digitalwrite(latchpin, high);
delay(125);
}
for(i=0; i<8;i++)
{
digitalwrite(latchpin, low);
shiftout(datapin, clockpin, lsbfirst, b10000000 >> i);
digitalwrite(latchpin, high);
delay(125);
}
for(i=0; i<8;i++)
{
digitalwrite(latchpin, low);
shiftout(datapin, clockpin, lsbfirst, b00000000 >> i);
digitalwrite(latchpin, high);
delay(125);
}
}
how have wired shift registers?
Arduino Forum > Using Arduino > Programming Questions > Shift registers working in paralel
arduino
Comments
Post a Comment