Library to work with displays based on TM1638 (Oshonsoft Pic Basic Compiler).

DogFlu66

Member
After the experience in programming the library to work with the TM1637 (the 4-digit card and the 6-digit and 6-key card), I have created the library to control the TM1638. In this case, the TM1638-based card that I have used is composed of 8 digits, 8 LEDs and 8 keys. All the elements it has can be handled individually using the functions created.

3 cables or signals are used for communication with the board, the protocol is not I2c or SPI, it uses its own protocol which is very simple.

The main functions are the following (LED&KEY):
SmgDisplayTM1638(): initializes the screen (LED&KEY and QYF).
BrightTM1638(brigh): sets the brightness level (LED&KEY and QYF).
DisplayStringTM1638(string): sends a string data to the display, it is the multipurpose function par excellence (it allows sending any type of variable after converting it to a string).
WriteRawDigitTM1638(Byte, DIGITx): sends an integer byte value individually to each digit on the screen.
DisplayValuesTM1638(Byte0, ....., Byte7): sends 8 bytes (integers) simultaneously that correspond to each of the digits.
WriteRawLedTM1638(status, LEDx): turns on or off the LED indicated on the card.
ScanKeyTM1638(): reads each of the keys individually or simultaneously.

Update - 2024/12/03:
I have updated the TM1638Library library, which controls the LED&KEY board, adding compatibility with the QYF-TM1638 module. The extended functions that are now supported on the QYF-TM1638 board are as follows:

Set_QYF_TM1638(): enables support for the QYF display and disables LED&KEY TM1638.
Set_LEDKEY_TM1638(): enables support for the LED&KEY display and disables QYF TM1638.
ScanKeyTM1638(): scans the module's keys.
WriteRawDigitTM1638(Byte, DIGITx): writes raw data to digits.
DisplayValuesTM1638(Byte0, ... Byte7): displays values to digits on the display.
DisplayStringTM1638(string): displays text strings on the display.

I'm leaving the files for anyone who wants to order one of these low-priced cards and wants to play with it for a while.

Example video.

 

Attachments

  • Test LED&KEY TM1638.bas
    5.6 KB · Views: 14
  • Test QFY_TM1638.bas
    4.7 KB · Views: 12
  • _TM1638Library.bas
    12.6 KB · Views: 15
  • _Pic18F46K22Library.bas
    43.4 KB · Views: 12
  • TM1638-16Key.jpg
    102.2 KB · Views: 13
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…