EasyManua.ls Logo

SunFounder 3in1 Kit - Page 166

Default Icon
351 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SunFounder 3in1 Kit
shiftOut() is used to shift out a byte of data one bit at a time, which means to shift a byte of data in datArray[num]
to the shifting register with the DS pin. MSBFIRST means to move from high bits.
shiftOut(DS,SHcp,MSBFIRST,datArray[num]);
After digitalWrite(STcp,HIGH) is run, the STcp will be at the rising edge. At this time, the data in the shift register
will be moved to the memory register.
digitalWrite(STcp,HIGH);
A byte of data will be transferred into the memory register after 8 times. Then the data of memory register are output
to the bus (Q0-Q7). For example, shiftout B00000001 will light up the LED controlled by Q0 and turn off the LED
controlled by Q1~Q7.
4.5.10 5.10 ShiftOut(Segment Display)
Previously, we used the shiftout() function to light up eight LEDs; here we use it to display 0-9 on the 7-aegment
Display.
The 7-segment Display is essentially a device packaged by 8 LEDs, of which 7 strip-shaped LEDs form an “8” shape,
and there is a slightly smaller dotted LED as a decimal point. These LEDs are marked as a, b, c, d, e, f, g, and dp. They
have their own anode pins and share cathodes. Their pin locations are shown in the figure below.
162 Chapter 4. Basic Projects

Related product manuals