TM1637 display modules are cheap chinese modules that are offered in different colors, with digital dots or with colon. Usually these are 4 digit, but there are 6 digit modules also. I bought mine for 1.84 USD delivered.
The problem is there are tons of libraries, tutorials and videos for Arduino, and very little for PIC microcontrollers. So here is my take for driving these with PIC.
I have couple of microcontroller in DIP packages for testing purposes and I chose PIC16F818. The library I wrote should work on most of 8-bit PICs.
The datasheet for the TM1637 is written in terrible english and is not very easy do decipher. An there was another problem with my module. The DIO and CLK buses are connected with 10k resistors to the Vdd and it is supposed only to drive the lines down. The datasheet recommend to connect two 100pF capacitors between each bus and the ground for filtering the noise. The manufacturer however decided to put 10nF there, which is 100 times higher. Of course this make driving the lines fast impossible. I replaced these capacitors with 82pF, but because mine were bigger (0805 instead of 0603) I had to solder them on the narrow side:
The microcontroller runs with 30 MHz crystal, so it has no problem with fast driving when there are correct capacitors on the module. In the library there are commented lines with delay subroutines, if uncomment these lines the library will work slower and will drive the module with its original capacitors.
I did not include a schematic, because the connection is very simple - DIO connects to one of the digital IO pins of the microcontroller and the CLK connects to another digital IO pin. In my demo CLK is connected to RA0 and DIO is connected to RA1. 5V and GND obviously connects to VDD and GND.
Here a short video demonstrating how it works:
Здравей Христо,
ReplyDeleteТествах библиотеката TM1637 с 16F873, рабори идеално ! Не можах да открия функция или начин, как да управлявам двете точки между двойките цифри. Може ли да споделиш с тази библиотека как да стане това ?
И още един втори въпрос - има ли я тази или подобна библиотека за mikroC?
DeleteЗдравей,
При дисплеите с две точки пинът който ги управлява е същият като на другите с десетична точка. Ако използваш функцията показваща стринг просто слагаш точка след втората цифра и би трябвало да светнат двете точки. Например "21.32" ще излезе "21:32". Ако искаш да мигат като на часовник, ще трябва да редуваш "21.32" и "2132". С mikroC не съм я пробвал. Теоретично не би трябвало да е трудно да се преработи - все пак е стандартен C, единствено специфичните регистри и битове може да са с различни имена. Трябва да тестваш и грешките, които ще се появят при компилиране да ги коригираш една по една.
Успех!