rkrasowski has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perl Monks, that may be the silly question. I am trying to read data from 74HC165 which is PISO serial register. How effective (fast) would be to read it using Perl? Any code examples? Thanks like always Robert
  • Comment on 74HC165 serial register reading with perl

Replies are listed 'Best First'.
Re: 74HC165 serial register reading with perl
by stevieb (Canon) on Jun 18, 2018 at 19:15 UTC

    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.

      Thanks, will check module tomorrow and let you know how things are. Now I know where to start. I ordered PCB and 74HC165, expect to get it on few days. Will try real example at that time. Thanks Robert
Re: 74HC165 serial register reading with perl
by haukex (Archbishop) on Jun 18, 2018 at 18:59 UTC

    How is this IC connected to the system? If you're working on a Raspberry Pi, you might want to look at stevieb's RPi:: series of modules, which includes RPi::SPI, RPi::Serial, and RPi::WiringPi.

    Update: Fixed missing links.

      Thanks haukex, unfortunately after I posted I realized that the IC in question here is parallel input, where I have only got code for the parallel output register.

      I'll put this chip on my list now though.