Product Overview: This module is designed specifically for the Banana Pi IO expansion modules, which can effectively solve the banana send IO port insufficient. Module uses four 74HC595 chips to expand 32 IO ports. As shown above, the top of the module will expand the IO of Banana Pi again that can be cascaded for more IO expansion modules can theoretically unlimited expansion.
Product Features: Expanded 32 GPIO Infinity connection for the same module Use wiringPi API ,sample code
Port: Banana Pi 2X13 port Banana Pi 2X13 cascade port Q0-Q31 expanded IO port
Product Parameters: Working voltage: 2.4V-5V IO voltage: 3.3V Expanded 32 unidirectional IO Connection through SPI 100 MHz (typical) shift out frequency 8-bit serial input 8-bit serial or parallel output Specified from -40C to +85C and from -40C to +125C
Typical Application: Drive the lattice screen Driver numeric display Drive matrix LED
how to connect:
test code: use 3 port you can driver it ,also need include VCC and GND。
ST24 SPI0_CS0 PI10
SH23 SPI0_CLK PI11
DS19 SPI0_MOSI PI12
test code:
unit SR595;
{$mode objfpc}{$H+}
interface
uses Classes, SysUtils, GPIO;
type
TSR595 = class
private
FDS: TGPIO; //MOSI
FSH: TGPIO; //CLK
FST: TGPIO; //CS
public
constructor Create;
destructor Destroy; override;
procedure Write(B: Byte); overload;
procedure Write(B: array of Byte; Len: Byte); overload;
procedure Send;
end;
implementation
constructor TSR595.Create;
begin
inherited Create;
FDS:= TGPIO.Create(PI, 12);
with FDS do
begin
Fun:= Fun1;
Data:= True;
end;
FSH:= TGPIO.Create(PI, 11);
with FSH do
begin
Fun:= Fun1;
Pull:= PULL_UP;
Data:= True;
end;
FST:= TGPIO.Create(PI, 10);
with FST do
begin
Fun:= Fun1;
Pull:= PULL_UP;
Data:= True;
end;
end;
destructor TSR595.Destroy;
begin
FDS.Free;
FSH.Free;
FST.Free;
inherited Destroy;
end;
procedure TSR595.Write(B: Byte); overload;
var I: Byte;
begin
//FST.Data:= False;
for I:= 0 to 7 do
begin
FSH.Data:= False;
FDS.Data:= ((B and $80) > 0);
B:= B shl 1;
FSH.Data:= True;
end;
//FST.Data:= True;
end;
procedure TSR595.Write(B: array of Byte; Len: Byte); overload;
var I: Byte;
begin
for I:= 0 to Len - 1 do Write(B[I]);
end;
procedure TSR595.Send;
begin
FST.Data:= False;
FST.Data:= True;
end;
end.
you also can use wiringpi to do this .