Matrix driver for HDSP-200x four character 5x7 alphanumeric displays. These are 12 pin DIL package ICs full of LEDs arranged in 4 characters of 5 columns & 7 rows each. The ones I have are the yellow HDSP-2001, but they are also available in red (HDSP-2000), high efficiency red (HDSP-2002) or green (HDSP 2003). I don't know if they are easily available anymore, but I thought, since I've got 30 or so, I'd have a go at programming them. See my notepad (http://mbed.org/users/tonymudd/notebook/led-matrix-display/) for videos of this working.
Dependents: alpha_message TP1_matriz
matrixDisplay.h@0:69eeea586a16, 2011-06-15 (annotated)
- Committer:
- tonymudd
- Date:
- Wed Jun 15 22:27:52 2011 +0000
- Revision:
- 0:69eeea586a16
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tonymudd | 0:69eeea586a16 | 1 | /* |
tonymudd | 0:69eeea586a16 | 2 | class to write to a matrix led display. |
tonymudd | 0:69eeea586a16 | 3 | |
tonymudd | 0:69eeea586a16 | 4 | Written by tonymudd (mbed@tonymudd.co.uk) |
tonymudd | 0:69eeea586a16 | 5 | |
tonymudd | 0:69eeea586a16 | 6 | */ |
tonymudd | 0:69eeea586a16 | 7 | #include "mbed.h" |
tonymudd | 0:69eeea586a16 | 8 | |
tonymudd | 0:69eeea586a16 | 9 | #ifndef MBED_MATRIXDISPLAY_H |
tonymudd | 0:69eeea586a16 | 10 | #define MBED_MATRIXDISPLAY_H |
tonymudd | 0:69eeea586a16 | 11 | |
tonymudd | 0:69eeea586a16 | 12 | class matrixDisplay |
tonymudd | 0:69eeea586a16 | 13 | { |
tonymudd | 0:69eeea586a16 | 14 | public: |
tonymudd | 0:69eeea586a16 | 15 | matrixDisplay( float scrollRate, PinName clockPinIn, PinName dataPinIn, |
tonymudd | 0:69eeea586a16 | 16 | PinName col1, PinName col2, PinName col3, |
tonymudd | 0:69eeea586a16 | 17 | PinName col4, PinName col5); |
tonymudd | 0:69eeea586a16 | 18 | virtual ~matrixDisplay(); |
tonymudd | 0:69eeea586a16 | 19 | void setMessage(char * newMessage); |
tonymudd | 0:69eeea586a16 | 20 | void stop(); |
tonymudd | 0:69eeea586a16 | 21 | |
tonymudd | 0:69eeea586a16 | 22 | private: |
tonymudd | 0:69eeea586a16 | 23 | void colChange(); |
tonymudd | 0:69eeea586a16 | 24 | void outputCol(int); |
tonymudd | 0:69eeea586a16 | 25 | void loadDisplay(); |
tonymudd | 0:69eeea586a16 | 26 | void scrollMessage(); |
tonymudd | 0:69eeea586a16 | 27 | static const int numOfColumns = 5; |
tonymudd | 0:69eeea586a16 | 28 | static const int numOfRows = 7; |
tonymudd | 0:69eeea586a16 | 29 | static const int numOfChars = 4; |
tonymudd | 0:69eeea586a16 | 30 | static const int numOfLeds = numOfRows * numOfChars; |
tonymudd | 0:69eeea586a16 | 31 | int column; |
tonymudd | 0:69eeea586a16 | 32 | // fires when the column changes - fast |
tonymudd | 0:69eeea586a16 | 33 | Ticker colTick; |
tonymudd | 0:69eeea586a16 | 34 | // fires to scroll the chars along one - slow. |
tonymudd | 0:69eeea586a16 | 35 | Ticker scroll; |
tonymudd | 0:69eeea586a16 | 36 | bool display[numOfColumns][numOfLeds]; // on the display now |
tonymudd | 0:69eeea586a16 | 37 | char text[numOfChars]; // text on the display |
tonymudd | 0:69eeea586a16 | 38 | char *message; // the whole message |
tonymudd | 0:69eeea586a16 | 39 | int whereInMessage; // which character in message to display next |
tonymudd | 0:69eeea586a16 | 40 | |
tonymudd | 0:69eeea586a16 | 41 | // And the hardware it uses: |
tonymudd | 0:69eeea586a16 | 42 | DigitalOut * clockPin; |
tonymudd | 0:69eeea586a16 | 43 | DigitalOut * dataPin; // DigitalOut data(p20); |
tonymudd | 0:69eeea586a16 | 44 | BusOut * columnsBus; // BusOut columns(p10,p11,p12,p13,p14); |
tonymudd | 0:69eeea586a16 | 45 | |
tonymudd | 0:69eeea586a16 | 46 | }; |
tonymudd | 0:69eeea586a16 | 47 | |
tonymudd | 0:69eeea586a16 | 48 | #endif |