TM1651 7-segment clock display (TM1637)

Hello,

I have a 4 digit 7 segment display from a digital alarm clock. It uses a TM1651 to drive the display, which seems similar to the TM1637.

I tried using the TM1637 library which worked for digits 2,3 and 4.

The first digit does not display properly and instead illuminates part of the 7 segments and the other dots on the display (the PM, alarm and colon dots).

I was looking for advice on how to modify the library. As well as controlling the first digit I'd also like to be able to control the other dots.

Any help would be greatly appreciated!

Hi,

Sounds to me like they connected the pm, alarm and colon indicators instead of 3 of the segments from digit 1.

The TMS1651 has only 7 segment driver pins and 4 digit driver pins (unlike tms1637 which has 8 segment and 6 digit pins). So to enable them to drive the colon, alarm and pm indicators, the manufacturers connected them instead of 3 of digit 1's segments. After all, if you only need to display the time in 12-hour format, you only need to drive segments a and c on digit 1, so that you can either display the number "1" or leave it blank.

So I suspect there is no way to display any number on digit 1 with your module, because at least 3 of its segments are not connected to anything.

Paul

Hi there,
For me there is no any problem interfacing the 7-segment on TM1637 without using header file. But I am unable to interface the keyboard input. Can anyone suggest me, how to interface with the keyboard.
The program which i have used for display is as follows:

/* Program for Display on TM1637 */

const int clock = 2;
const int data = 3;
/0/ /1/ /2/ /3/ /4/ /5/ /6/ /7/ /8/ /9/
uint8_t digits[] = { 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f };

void setup()
{
pinMode(clock, OUTPUT);
pinMode(data, OUTPUT);

start();
writeValue(0x8c);
stop();

// clear display
write(0x00, 0x00, 0x00, 0x00);

}

void loop()
{
write(digits[1],digits[2],digits[3],digits[4]);
}

void write(uint8_t first, uint8_t second, uint8_t third, uint8_t fourth)
{
start();
writeValue(0xc0);
writeValue(first);
writeValue(second);
writeValue(third);
writeValue(fourth);
stop();
}

void start(void)
{
digitalWrite(clock,HIGH);//send start signal to TM1637
digitalWrite(data,HIGH);
delayMicroseconds(5);

digitalWrite(data,LOW);
digitalWrite(clock,LOW);
delayMicroseconds(5);
}

void stop(void)
{
digitalWrite(clock,LOW);
digitalWrite(data,LOW);
delayMicroseconds(5);

digitalWrite(clock,HIGH);
digitalWrite(data,HIGH);
delayMicroseconds(5);
}

bool writeValue(uint8_t value)
{
for(uint8_t i = 0; i < 8; i++)
{
digitalWrite(clock, LOW);
delayMicroseconds(5);
digitalWrite(data, (value & (1 << i)) >> i);
delayMicroseconds(5);
digitalWrite(clock, HIGH);
delayMicroseconds(5);
}

// wait for ACK
digitalWrite(clock,LOW);
delayMicroseconds(5);

pinMode(data,INPUT);

digitalWrite(clock,HIGH);
delayMicroseconds(5);

bool ack = digitalRead(data) == 0;

pinMode(data,OUTPUT);

return ack;
}

I added code for keyboard in TM1637 library which is attached here.

Usage:

uint8_t keypressed;
keypressed = tm1637.keyscan();

TM1637.cpp (5.91 KB)

TM1637.h (2.43 KB)