Is this for a Raspberry Pi? My RPi::WiringPi handles this shift register if on a Pi. See that linked documentation and associated FAQ for full details:
use RPi::WiringPi;
use RPi::Const qw(:all);
my $pi = RPi::WiringPi->new;
my ($base, $num_pins, $data, $clk, $latch)
= (100, 8, 5, 6, 13);
$pi->shift_register(
$base, $num_pins, $data, $clk, $latch
);
# now we can access the new 8 pins of the
# register commencing at new pin 100-107
for (100..107){
my $pin = $pi->pin($_);
$pin->write(HIGH);
}
Update: Whoops, I misread the IC device number. My code is for a 74HC595 (output) not a 74HC165 (input). Sorry for the noise. |