TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139248 times)
  2. FAT32 Library (71743 times)
  3. Network Ethernet Library (57115 times)
  4. USB Device Library (47428 times)
  5. Network WiFi Library (43082 times)
  6. FT800 Library (42403 times)
  7. GSM click (29835 times)
  8. mikroSDK (28073 times)
  9. PID Library (26885 times)
  10. microSD click (26198 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

7-SEG 2 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.4

mikroSDK Library: 2.0.0.0

Category: LED segment

Downloaded: 82 times

Not followed.

License: MIT license  

7-SEG 2 Click is a compact add-on board that represents an easy solution for adding a numeric or hexadecimal display to your application. This board features the LDT-M2804RI, a three-digit seven-segment display from Lumex. The display has a 0.28” height, red LED segments, gray faces, and white diffused segments. All three digits come with a following dot point that can be used as a decimal point in displaying the number values.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "7-SEG 2 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "7-SEG 2 Click" changes.

Do you want to report abuse regarding "7-SEG 2 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


7-SEG 2 Click

7-SEG 2 Click is a compact add-on board that represents an easy solution for adding a numeric or hexadecimal display to your application. This board features the LDT-M2804RI, a three-digit seven-segment display from Lumex. The display has a 0.28” height, red LED segments, gray faces, and white diffused segments. All three digits come with a following dot point that can be used as a decimal point in displaying the number values.

7seg2_click.png

Click Product page


Click library

  • Author : MikroE Team
  • Date : Sep 2023.
  • Type : I2C type

Software Support

We provide a library for the 7-SEG 2 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for 7-SEG 2 Click driver.

Standard key functions :

  • c7seg2_cfg_setup Config Object Initialization function.

    void c7seg2_cfg_setup ( c7seg2_cfg_t *cfg );
  • c7seg2_init Initialization function.

    err_t c7seg2_init ( c7seg2_t *ctx, c7seg2_cfg_t *cfg );
  • c7seg2_default_cfg Click Default Configuration function.

    err_t c7seg2_default_cfg ( c7seg2_t *ctx );

Example key functions :

  • c7seg2_set_segments_current This function is used to set the current value of the segment's leds.

    err_t c7seg2_set_segments_current ( c7seg2_t *ctx, float current_val );
  • c7seg2_write_segment This function is used to write a number [0..9] to a selected segment [0..2] with or w/o a decimal pointer.

    err_t c7seg2_write_segment ( c7seg2_t *ctx, uint8_t segment, uint8_t number, uint8_t dpt );
  • c7seg2_write_number This function is used to write a number [0..999] to a selected segment [0..2] with or w/o a decimal pointer.

    err_t c7seg2_write_number ( c7seg2_t *ctx, uint16_t number, uint8_t dpt );

Example Description

The example demonstrates the use of the 7-SEG 2 Click board by displaying a counter number [0.00-9.99] which is incremented by 0.01 at a desired rate.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs default configuration, sets the device in output enabled mode and checks communication by reading device ID.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    c7seg2_cfg_t c7seg2_pnp_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.    
    c7seg2_cfg_setup( &c7seg2_pnp_cfg );
    C7SEG2_MAP_MIKROBUS( c7seg2_pnp_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == c7seg2_init( &c7seg2, &c7seg2_pnp_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    uint8_t device_id = 0;
    c7seg2_read_reg( &c7seg2, C7SEG2_REG_DEVICE_ID, &device_id );
    if ( C7SEG2_DEVICE_ID != device_id )
    {
        log_error( &logger, " Communication error." );
        for ( ; ; );
    }

    if ( C7SEG2_ERROR == c7seg2_default_cfg ( &c7seg2 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

Writes a counter number [0.00-9.99] to the display as frequently as possible. The displayed counter value is incremented by 0.01 at a rate defined with the C7SEG2_NUM_COUNTER_RATE macro.

void application_task ( void )
{
    static uint16_t counter = 0;
    static uint16_t time = 0;

    c7seg2_write_number( &c7seg2, counter, C7SEG2_DP_AT_SEGMENT_2 );

    if ( ++time >= C7SEG2_NUM_COUNTER_RATE ) 
    {
        if ( ++counter > C7SEG2_MAX_NUMBER )
        {
            counter = 0;
        }
        time = 0;
    }
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.7SEG2

Additional notes and informations

Depending on the development board you are using, you may need USB UART Click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.


ALSO FROM THIS AUTHOR

PAC1934 click

5

PAC1934 click carries the PAC1934 four channel DC power/energy monitor from Microchip. The click is designed to run on either 3.3V or 5V power supply. It communicates with the target microcontroller over an I2C interface.

[Learn More]

ADC 11 Click

0

ADC 11 Click is a compact add-on board that contains a high-performance data converter. This board features the LTC1864, a 16-bit 250ksps analog-to-digital converter from Analog Devices. With a typical supply current of only 850µA at the maximum sampling frequency, the LTC1864 is among the lowest power consumption ADCs available. After conversion, the LTC1864 goes into a low-power Sleep mode, further reducing the supply current. That’s why it can run at proper micro-power levels in applications that do not require the maximum sampling rate of the LTC1864. This Click board™ is suitable for high-speed data acquisition, low power battery-operated instrumentation, isolated and remote data acquisition, and many other applications.

[Learn More]

mikromedia HMI example

1

mikromedia HMI is a product line of 18 smart displays intended to be used as OEM parts. It's a spinoff from the original mikromedia, the feature-rich multimedia development board.All mikromedia HMI boards are powered by FT900Q, FTDI Chip's 32-bit MCU.

[Learn More]