shift595 - shift595 74HC595 Chip#

Adaptation status unknown

Note

This page document is automatically generated by this file. If there is any error, please submit issue or help modify pr, thank you!

Example

--Attention:
--1、sclk shift clock pin and dat data pin must be provided during initialization, rclk can be selected according to application requirements
--2、AIR101 The official core board, the bottom layer is LuatOS-SoC_V0017_AIR101.soc, and the serial clock frequency of this script library is tested.18KHz
--Usage Examples:
--Hardware module: common anode 4-bit digital tube driven by dual 595
local shift595 = require("shift595")
sys.taskInit(function() 

    shift595.init(pin.PB08,pin.PB09,pin.PB10)  -- sclk,dat,rclk
    
    while 1 do
        local wei = 1
        for i = 0, 3, 1 do
            shift595.out(0x82,shift595.MSB)--Send segment data, followed by bit select data
            shift595.out(wei,shift595.MSB)--Send segment data, followed by bit select data
            shift595.latch() --Latch
            wei = wei<<1
            sys.wait(500)
        end
        sys.wait(1000)
    end
end
)

shift595.init(sclk,dat,rclk)#

75hc595 Chip initialization

Parameters

Incoming Value Type

Explanation

number

sclk,Defines the pin that drives the 595 serial clock signal

number

dat,Defines the pin that drives 595 serial data

number

rclk,Define the pin that drives the 595 latch signal, optional

Return Value

None

Examples

shift595.init(pin.PB08,pin.PB09,pin.PB10)  -- sclk,dat,rclk

shift595.out(dat,endian)#

Serial output of one byte to the shift register of the 74hc595 chip

Parameters

Incoming Value Type

Explanation

number

dat,Bytes of data sent

number

endian,Specifies the size-side mode when sending byte data. The shift595.MSB and shift595.LSB parameters are available. Default shift595.MSB

Return Value

None

Examples

shift595.out(0x82,shift595.MSB)
shift595.out(0x82)  --Default shift595.MSB, equivalent to above

shift595.latch()#

A high pulse is given to the RCLK line of the 74hc595 chip, so that the data in the shift register is transferred to the latch. When OE is enabled, the data is output to the QA ~ QH pins. This function call is invalid if the rclk pin is not used during initialization.

Parameters

None

Return Value

None

Examples

shift595.latch()