ShiftIn()

From Microduino Wiki
Revision as of 03:17, 17 August 2016 by Fengfeng (talk) (Created page with "shiftIn() *'''Description''' Shift one byte of a number in one by one, starting from the most significant bit(on the leftest)the least significant bit(on the rightest...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

shiftIn()

  • Description

Shift one byte of a number in one by one, starting from the most significant bit(on the leftest)the least significant bit(on the rightest). For every bit, firstly, pull the clock voltage up, and then read one bit from the data transmission wire, finally, pull the clock wire down.

Note:This is a software implementation;Arduino provides a SPI library of hardware implementation, of which the speed is quicker but it is only valid for specified pins.

  • Syntax

shiftIn(dataPin,clockPin,bitOrder)
  • Parameters

dataPin:Output the pins of each bit of the data(int).

clockPin:The level change(int) of this pin when dataPin has a value . bitOrder:The order of output bit, the highest priority or the lowest priority.

  • Return

The value read(byte)

[Return to Arduino Syntax Manual]