ShiftOut

From chipKIT
Jump to: navigation, search

Synopsis

 void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val)

Description

shiftOut() utilises a pair of I/O pins to create a half-duplex synchronous serial interface. dataPin is set to represent one bit in the byte val and the clockPin is then toggled HIGH then LOW. val is then shifted either left or right and the operation repeated until all 8 bits have been transferred. The parameter bitOrder indicates in which direction the shift should occur and to which end of the byte the outgoing bit should be read from. Possible values for bitOrder are MSBFIRST or LSBFIRST.

This functionality works akin to the transmitting portion of a master SPI interface.

Return Value

None

Conforming To

shiftOut() conforms to the Arduino 1.6.x API.

Examples

 shiftOut(3, 4, MSBFIRST, val);

See Also

digitalRead(), digitalWrite(), getPinMode(), pinMode(), pulseIn(), shiftIn()