Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SSegSRDriver Class Reference
7-Segment Display Driver class, via a 8-bit shift register (such as the 74HC595) More...
#include <7SegSRDriver.h>
Public Member Functions | |
| SSegSRDriver (PinName srData, PinName srClock, PinName srLatch, bool disp_type) | |
| Create a 7-Segment Display Driver object connected to a 8-bit shift register on the given DigitalOut pins. | |
| void | set_type (bool disp_type) |
| Change the type of 7-Segment Display. | |
| void | write (unsigned char number) |
| Sets the currently shown digit on the display. | |
| void | write (unsigned char number, bool dp) |
| Sets the currently shown digit on the display along with the decimal place. | |
| void | write_raw (unsigned char number) |
| Sets the segments of the display directly Segments are lit by binary flags where LSB is the decimal point, then segments a-g up to the MSB e.g. | |
| void | clear () |
| Turn all segments of the display off. | |
Detailed Description
7-Segment Display Driver class, via a 8-bit shift register (such as the 74HC595)
Display should be hooked up to shift register as follows: Q0 : Decimal Point, Q1-Q7 : Segments a-g
Example:
#include "mbed.h" #include "7SegSRDriver.h" SSegSRDriver display(p27,p25,p26, SSegSRDriver_COMN_ANODE); int main() { while (1) { // Show the chars 0-9 then A-F, flashing the decimal point on and off for (int i=0; i<16; i++) { display.write(i,i%2 == 0); wait(1); } } }
Definition at line 57 of file 7SegSRDriver.h.
Constructor & Destructor Documentation
| SSegSRDriver | ( | PinName | srData, |
| PinName | srClock, | ||
| PinName | srLatch, | ||
| bool | disp_type | ||
| ) |
Create a 7-Segment Display Driver object connected to a 8-bit shift register on the given DigitalOut pins.
- Parameters:
-
srData Shift Register Data pin (DigitalOut) srClock Shift Register Clock pin (DigitalOut) srLatch Shift Register Latch pin (DigitalOut) disp_type Display Type: Common Anode/Cathode (SSegSRDriver_COMN_ANODE (0) or SSegSRDriver_COMN_CATHODE (1))
Definition at line 29 of file 7SegSRDriver.cpp.
Member Function Documentation
| void clear | ( | ) |
Turn all segments of the display off.
Definition at line 38 of file 7SegSRDriver.cpp.
| void set_type | ( | bool | disp_type ) |
Change the type of 7-Segment Display.
- Parameters:
-
disp_type Display Type: Common Anode/Cathode (SSegSRDriver_COMN_ANODE (0) or SSegSRDriver_COMN_CATHODE (1))
Definition at line 34 of file 7SegSRDriver.cpp.
| void write | ( | unsigned char | number ) |
Sets the currently shown digit on the display.
- Parameters:
-
number The digit to display (0-15) to show numbers 0-9 and letters A-F
Definition at line 42 of file 7SegSRDriver.cpp.
| void write | ( | unsigned char | number, |
| bool | dp | ||
| ) |
Sets the currently shown digit on the display along with the decimal place.
- Parameters:
-
number The digit to display (0-15) to show numbers 0-9 and letters A-F dp If the decimal place should be lit (0:Off, 1:On)
Definition at line 46 of file 7SegSRDriver.cpp.
| void write_raw | ( | unsigned char | number ) |
Sets the segments of the display directly Segments are lit by binary flags where LSB is the decimal point, then segments a-g up to the MSB e.g.
to light segments e, f and the decimal place = 01100001
- Parameters:
-
bValue The segments to light
Definition at line 56 of file 7SegSRDriver.cpp.
Generated on Fri Jul 15 2022 08:30:50 by
1.7.2