-
Notifications
You must be signed in to change notification settings - Fork 74
Special Commands
jimblom edited this page Oct 2, 2012
·
28 revisions
This page will discuss the Serial 7-Segment Display's special commands:
- Clear display
- Cursor control
- Decimal, colon, and apostrophe control
- Brightness control
- Individual segment control
- Baud rate configuration
- I2C address configuration
- Factory reset.
First, a quick breakdown of the commands, their control byte and any data bytes:
Special Command | Command byte | Data byte range |
Clear display | 0x76 | None |
Decimal control | 0x77 | 0-127 |
Cursor control | 0x79 | 0-3 |
Brightness control | 0x7A | 0-255 |
Digit 1 control | 0x7B | 0-127 |
Digit 2 control | 0x7C | 0-127 |
Digit 3 control | 0x7D | 0-127 |
Digit 4 control | 0x7E | 0-127 |
Baud rate config | 0x7F | 0-11 |
I2C address Config | 0x80 | 1-254 |
Factory reset | 0x80 | None |
The clear display command performs two functions:
- Clear the display - all LEDs, including segments and decimal points, are turned off.
- Reset the cursor to position 1, the left-most digit.
The clear display command byte is 0x76
.
There is no data byte, so any displayable data sent after the clear display command will be displayed on digit 1.
Arduino Sample Snippet (Serial Mode): In the above example, we can't be guaranteed that the cursor is at position 1. To ensure that it is, we can use the clear display command before sending our data.
// ... after initializing Serial at the correct baud rate... Serial.write(0x76); // Clear display command, resets cursor Serial.write(0x01); // Hex value for 1, will display '1' Serial.write('2'); // ASCII value for '2', will display '2' Serial.write(0x0A); // Hex value for 10, will display 'A' Serial.write('B'); // ASCII value for 'B', will display 'b'
Note: The clear display command byte value is equivalent to the ASCII value for the 'v' character. This value was chosen because 'v' is not all that displayable on a 7-segment display.