Shift
Module Name | Shift |
Import Name | Shift |
Options
SetInput
Sub SetInput(ByRef dataPin As Bit)- dataPin - Port pin. For example, D2.
Sets the shift data in pin.
SetOutput
Sub SetOutput(ByRef dataPin As Bit)
- dataPin - Port pin. For example, D3.
Sets the shift data out clock pin.
SetClock
Sub SetClock(ByRef clockPin As Bit, Optional idleHigh As Boolean = False)
- clockPin - Port pin. For example, D4.
- idleHigh - Idle high, default is false.
Sets the clock pin. An optional idle high determines if the clock pin idles high or low. The default is to idle low.
Out
Sub Out(mode As Byte, data As ShiftType, shiftAmount As Byte)
- mode - The shift mode. Can be LsbFirst or MsbFirst.
- data - The data to shift. Max size can be 8, 16 or 32 bits depending on the shift max module option. Default is 16 bits.
- shiftAmount - The number of bits to shift.
LsbFirst | LSB sent first |
---|---|
MsbFirst | MSB sent first |
Shift out a value by shiftAmount bits.
In
Function In(mode As Byte, shiftAmount As Byte) As ShiftType
- mode - The shift mode. Can be MsbPre, MsbPost, LsbPre or LsbPost.
- shiftAmount - The number of bits to shift in.
MsbPre | MSB first, sample before clock |
---|---|
MsbPost | MSB first, sample after clock |
LsbPre | LSB first, sample before clock |
LsbPost | LSB first, sample after clock |
Shift in a value by shiftAmount bits. Returns the shifted in data. Max size can be 8, 16 or 32 bits depending on the shift max module option. Default is 16 bits.
#option SHIFT_MAX
The maximum shift size (in or out) can be 8, 16 or 32 bits. Using a smaller value will reduce the overall code footprint. By default, it is set to 16 bits.
#option SHIFT_CLOCK
The shift clock delay, in microseconds. Can be 1 or 2 us. By default, it is set to 1 us.