TM1628 LED display controller - library for Arduino
The only Arduino compatible library I was able to find for TM1628 is developed by Vasyl Yudin and is available on GitHub. But, I couldn't get any readable output on display. That happened because my front panel had a different segment assignment to the controller than what I found on YouTube (the display with disc icon on it).
My front panel came from TeleSystem TS5.9RX DVD Recorder and it has 7 digits and some other indicator LEDs. The PCB also contains 5 keys - but I can expand it by adding more buttons. Below is a sketch example for this front panel. It is 5V compatible so it can be connected directly to 5V levels development boards like Arduino and compatible.
This is an example sketch that prints on display the value read from key presses.
#include <tm1628ts.h> TM1628ts disp(9, 7, 8); void setup() { pinMode(13, OUTPUT); digitalWrite(13, HIGH); disp.init(0); // start with lowest intensity delay(1000); digitalWrite(13, LOW); for (int i = 7; i > 0; i--) { disp.putDigitAt(16, i); disp.writeBuffer(); delay(150); } delay(300); for (int i = 7; i > 0; i--) { disp.clearBuffer(i); disp.writeBuffer(); delay(150); } } void loop() { byte rcv = disp.getKeyboard(); digitalWrite(13, rcv > 0 ? HIGH : LOW); disp.clearBuffer(); disp.putNumberAt(rcv, 1, false, 10); disp.writeBuffer(); // command 3 delay(100); }You can see the basic usage. Declare a TM1628ts object and specify pins (Clock, Data, Strobe). Use init() with a value between 0 and 7 to initialize and turn on the display with specified intensity. Use init() without arguments and the display gets initialized but remains turned off. You will have to use turnOn() thereafter to start it. Only writeBuffer() writes local stored data to controller so don't forget to call it after setting status LEDs or setting numbers/digits. Check often if a key has been pressed using getKeyboard().
This is how segments are assigned to the buffer array that is sent to the controller.
TM1628 segment assignments |
TM1628 panel showing HEX number 4bb807f |
TM1628 front panel from TeleSystem TS5.9RX DVD |
No comments :
Post a Comment
Please read the comments policy before publishing your comment.