Author | Rob Hamerling, Copyright © 2014..2014, all rights reserved. |
Adapted-by | |
Compiler | 2.4q2 |
Library for a module with TM1638 with - serial interface - 8 7-segment displays with dp (decimal point) - 8 LEDs - 8 push buttons . Data may be displayed anywhere in the 7-segment displays. The position may be specified with an offset (depending on data type) . The tm1638 module uses 3 data wires, which have to be specified by the user. Before including this library declare the following aliases (mandatory): . alias tm1638_dio is pin_?? -- pin for data I/O signal alias tm1638_clk is pin_?? -- pin for clock signal alias tm1638_stb is pin_?? -- pin for chip select signal alias tm1638_dio_direction is pin_??_direction . The pins for tm1638_clk and tm1638_stb must be configured for digital output by the user program . The following constant may be specified as well (optionally): . const byte TM1638_WIDTH = ? (number of 7-segment digits, defaults to 8) . Initialize the TM1638 with tm1638_init()
- Supports (= has been tested) only a module with tm1638 chip and 8 display digits, 8 single color LEDs and 8 buttons. Support for modules with duo-leds or TM1640 may be added later.
const byte TM1638_MODE_NORMAL = 0b_0100_0000
const byte TM1638_ADDRESS_AUTO = 0b_0100_0000
const byte TM1638_ADDRESS_SELECT = 0b_1100_0000
const byte TM1638_DISPLAY_OFF = 0b_1000_0000
const byte TM1638_MODE_TEST = 0b_0100_1000
const byte TM1638_LED_ON = 0b_0000_0001
const byte TM1638_DISPLAY_PWM1 = 0b_1000_0000
const byte TM1638_READ_KEYS = 0b_0100_0010
const byte TM1638_DISPLAY_PWM11 = 0b_1000_0100
const byte TM1638_DISPLAY_PWM4 = 0b_1000_0010
const byte TM1638_DISPLAY_PWM14 = 0b_1000_0111
const byte TM1638_DISPLAY_PWM12 = 0b_1000_0101
const byte TM1638_DISPLAY_PWM13 = 0b_1000_0110
const byte TM1638_DISPLAY_PWM10 = 0b_1000_0011
const byte TM1638_DISPLAY_PWM2 = 0b_1000_0001
const byte TM1638_DOT = 0b_1000_0000
const byte TM1638_WRITE_DATA = 0b_0100_0000
const byte TM1638_LED_OFF = 0b_0000_0000
const byte TM1638_DISPLAY_ON = 0b_1000_1000
const byte TM1638_ADDRESS_FIXED = 0b_0100_0100
tm1638_set_leds(byte in leds)
tm1638_display_clear()
tm1638_init()
tm1638_display_byte_bin(byte in number)
const byte TM1638_MODE_NORMAL = 0b_0100_0000
No documentation found
const byte TM1638_ADDRESS_AUTO = 0b_0100_0000
No documentation found
const byte TM1638_ADDRESS_SELECT = 0b_1100_0000
base of command byte
const byte TM1638_DISPLAY_OFF = 0b_1000_0000
No documentation found
const byte TM1638_MODE_TEST = 0b_0100_1000
No documentation found
const byte TM1638_LED_ON = 0b_0000_0001
No documentation found
const byte TM1638_DISPLAY_PWM1 = 0b_1000_0000
No documentation found
const byte TM1638_READ_KEYS = 0b_0100_0010
No documentation found
const byte TM1638_DISPLAY_PWM11 = 0b_1000_0100
PWM dutycycle for LEDs
const byte TM1638_DISPLAY_PWM4 = 0b_1000_0010
No documentation found
const byte TM1638_DISPLAY_PWM14 = 0b_1000_0111
No documentation found
const byte TM1638_DISPLAY_PWM12 = 0b_1000_0101
No documentation found
const byte TM1638_DISPLAY_PWM13 = 0b_1000_0110
No documentation found
const byte TM1638_DISPLAY_PWM10 = 0b_1000_0011
No documentation found
const byte TM1638_DISPLAY_PWM2 = 0b_1000_0001
No documentation found
const byte TM1638_DOT = 0b_1000_0000
segment of decimal point
const byte TM1638_WRITE_DATA = 0b_0100_0000
No documentation found
const byte TM1638_LED_OFF = 0b_0000_0000
No documentation found
const byte TM1638_DISPLAY_ON = 0b_1000_1000
No documentation found
const byte TM1638_ADDRESS_FIXED = 0b_0100_0100
No documentation found
tm1638_set_leds(byte in leds)
Title: Set all LEDs Input: Byte with bit pattern: 0 = off, 1 = on, Leftmost led (LED1) is controlled by the least significant bit. Returns: nothing
tm1638_display_clear()
Title: Clear all display digits (inclusive decimal point) Input: None
tm1638_init()
Title: Initialize TM1638 module Notes: - The TM1638 module will be kept in fixed address mode, only during init auto-increase mode is used (temporary).
tm1638_display_byte_bin(byte in number)
Title: Display binary number (byte, 8 bits) Input: - byte with value to be displayed
_tm1638_write_byte(byte in data)
Title: Send byte 'raw' to the TM1638 (8 bits bit-banging) Notes: STB should have been (re)set according to requirements of caller
_tm1638_write_command(byte in cmd)
Title: Send a command to the TM1638 Input: - Byte with command
tm1638_get_buttons() return byte
Title: Get button positions Returns: Byte with bit pattern of buttons (0 = off, 1 = on) Leftmost button (S1) is represented by the least significant bit.
_tm1638_read_byte() return byte
Title: Receive a byte from TM1638 Returns: Byte Notes: - STB should have been (re)set according to requirements of caller DIO should be configured for input (and be pulled up?)
12f1572 | 12f1572_tm1638.jal |
12f683 | 12f683_tm1638.jal |
16f648a | 16f648a_tm1638.jal |
16f723 | 16f723_tm1638.jal |
16f73 | 16f73_tm1638.jal |
16f877 | 16f877_tm1638.jal |
16f877a | 16f877a_tm1638.jal |
16f88 | 16f88_tm1638.jal |
18f2450 | 18f2450_tm1638.jal |
18f2520 | 18f2520_tm1638.jal |
18f2550 | 18f2550_tm1638.jal |
18f2620 | 18f2620_tm1638.jal |
18f452 | 18f452_tm1638.jal |
18f4550 | 18f4550_tm1638.jal |
18f4620 | 18f4620_tm1638.jal |
18f67j50 | 18f67j50_tm1638.jal |