Using the Galileo II and ANSI C, demonstrate how to drive the MCP23017 IO Expanders 16 general purpose outputs, themselves driving four 74HC4511 seven segment display drivers.
The 74HC4511 accepts as inputs a 4 bit binary encoded decimal value. This value is interpreted as a single digit, and the 74HC4511 converts this value to provide output to the seven individual segments to display the digit.
The C code demonstrates how to interact with the MCP23017 using the MRAA I2C interface. This interaction is composed of two bytes, with each byte driving the two general purpose IO groups. Each byte is composed of eight bits - two four bit groups. Each four bit group represents a digit to the 74HC4511.
The C code further demonstrates the use of structures - to contain the four digit values, and for each, a flag indicating whether to enable the specific seven segment display, or blank it out all together. The code further demonstrates the power of C bit wise operators, and the simplicity of manipulating bits. Finally, for the new C coder, clean code demonstrating the use of explicit values in function calls, and avoiding the use of global variables.
No preview (download only).
Did you replicate this project? Share it!I made one
Love this project? Think it could be improved? Tell us what you think!