tm1640

Library to support 7-segment display module with TM1640

Author Rob Hamerling, Copyright © 2014..2014, all rights reserved.
Adapted-by
Compiler 2.4q2

Description

Library for a module with TM1640 with
- serial interface
- 16  7-segment displays with dp (decimal point)
.
Data may be displayed anywhere in the 7-segment displays.
The position may be specified with an offset (depending on data type)
.
The tm1640 module uses 2 data wires, which have to be specified by the user.
Before including this library declare the following aliases (mandatory):
.
alias tm1640_din            is pin_??                    -- pin for data I/O signal
alias tm1640_clk            is pin_??                    -- pin for clock signal
which should be set to OUTPUT by the user program
.
The following constant may be specified as well (optionally):
.
const byte TM1640_WIDTH    =  ?          (number of 7-segment digits, defaults to 16)
.
Initialize the TM1640 with tm1640_init()


Notes

- Supports (= has been tested) with a module with tm1640 chip
         and 16 7-segment display digits


Dependencies


Summary

Global variables/contants

Procedures

Private

Functions


API details

Global variables/contants

Procedures

  • tm1640_init()

    Title:  Initialize TM1640 module
    Notes:
    
    

  • tm1640_display_clear()

    Title:  Clear all display digits (inclusive decimal point)
    Input:  (none)
    Notes:  - Set display into normal mode (disable test mode)
    and set display into fixed address mode at return.
    
    

  • tm1640_display_word_bin(word in number)

    Title: Display binary number (word, 16 bits)
    Input: word with value to be displayed
    
    

Private
  • _tm1640_write_byte_raw(byte in data)

    Title:  Send byte 'raw' to the TM1640 (8 bits bit-banging)
    Input:  byte to be transferred
    Notes:  - tm1640_din should have been reset before calling this procedure
     must be followed by 1 clock cycle after last byte of an operation
     data handling and loop logic ensure that timing constraints
    are not exceeded (tested with 32 MHz oscillator frequency)
    
    

  • _tm1640_write_command(byte in cmd)

    Title:  Send a command (single byte) to the TM1640
    Input:  - Byte with command
    
    


Functions


Related samples

Here are the list of samples which use this library:

12f157212f1572_tm1640.jal
12f68312f683_tm1640.jal
16f648a16f648a_tm1640.jal
16f72316f723_tm1640.jal
16f7316f73_tm1640.jal
16f87716f877_tm1640.jal
16f877a16f877a_tm1640.jal
16f8816f88_tm1640.jal
18f14k5018f14k50_tm1640.jal
18f245018f2450_tm1640.jal
18f252018f2520_tm1640.jal
18f255018f2550_tm1640.jal
18f262018f2620_tm1640.jal
18f45218f452_tm1640.jal
18f455018f4550_tm1640.jal
18f462018f4620_tm1640.jal
18f67j5018f67j50_tm1640.jal