c7segrgb  2.0.0.0
Main Page

7-SEG RGB Click

7-SEG RGB Click carries a full color single 7 segment digit display. The Click is designed to run on either 3.3V or 5V power supply. It communicates with the target microcontroller over the CS, and PWM pin on the mikroBUS™ line.

Click Product page


Click library

  • Author : MikroE Team
  • Date : Jan 2020.
  • Type : GPIO type

Software Support

We provide a library for the 7SegRgb 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for 7SegRgb Click driver.

Standard key functions :

Example key functions :

  • c7segrgb_set_num The function sets character and its color.
    void c7segrgb_set_num ( c7segrgb_t *ctx, uint8_t character, uint8_t green_brightness, uint8_t red_brightness, uint8_t blue_brightness );
  • c7segrgb_set_seven_seg The function sets the state and color of every segment from Click board object segment array data.

Examples Description

This Click shows all ten digits on a full-color single 7 segment digit display. Each segment has R, G, B LEDs that can be adjusted in 255 steps and the ability to control the brightness of all the LED.

The demo application is composed of two sections :

Application Init

Initialization driver enables - GPIO.

void application_init ( void )
{
// Click initialization.
C7SEGRGB_MAP_MIKROBUS( cfg, MIKROBUS_1 );
c7segrgb_init( &c7segrgb, &cfg );
for ( uint8_t cnt = 0; cnt < 8; cnt++ )
{
c7segrgb.segments[ cnt ] = segments_data[ cnt ];
}
c7segrgb_set_seven_seg( &c7segrgb );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}

Application Task

This is an example which demonstrates the use of 7-SEG RGB Click board. This simple example shows all ten digits in different colors on 7-SEG RGB Click.

void application_task ( void )
{
for ( uint8_t cnt_i = 0; cnt_i < 10; cnt_i++ )
{
for ( uint8_t cnt_j = 10; cnt_j > 0; cnt_j-- )
{
c7segrgb_set_num( &c7segrgb, CHARACTER_TABLE[ cnt_i ], 4 * cnt_i, 4 * cnt_j, cnt_i * cnt_j );
Delay_ms ( 100 );
}
}
c7segrgb_set_num( &c7segrgb, C7SEGRGB_POINT, 10, 10, 10 );
Delay_ms ( 1000 );
c7segrgb_set_num( &c7segrgb, C7SEGRGB_ZERO, 40, 40, 40 );
Delay_ms ( 1000 );
c7segrgb_set_num( &c7segrgb, C7SEGRGB_ONE, 40, 0, 0 );
Delay_ms ( 1000 );
c7segrgb_set_num( &c7segrgb, C7SEGRGB_TWO, 0, 40, 0 );
Delay_ms ( 1000 );
c7segrgb_set_num( &c7segrgb, C7SEGRGB_THREE, 0, 0, 40 );
Delay_ms ( 1000 );
c7segrgb_set_num( &c7segrgb, C7SEGRGB_FOUR, 40, 0, 40 );
Delay_ms ( 1000 );
c7segrgb_set_num( &c7segrgb, C7SEGRGB_FIVE, 0, 40, 40 );
Delay_ms ( 1000 );
c7segrgb_set_num( &c7segrgb, C7SEGRGB_SIX, 40, 40, 0 );
Delay_ms ( 1000 );
c7segrgb_set_num( &c7segrgb, C7SEGRGB_SEVEN, 20, 30, 40 );
Delay_ms ( 1000 );
c7segrgb_set_num( &c7segrgb, C7SEGRGB_EIGHT, 40, 15, 31 );
Delay_ms ( 1000 );
c7segrgb_set_num( &c7segrgb, C7SEGRGB_NINE, 20, 10, 30 );
Delay_ms ( 1000 );
}

Note

Make sure the logic delays are defined for your system in the c7segrgb_delays.h file.

Additional Functions :
void logic_one ( )  - Generic logic one function.
void logic_zero ( ) - Generic logic zero function.

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.7SegRgb

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. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.


C7SEGRGB_SEVEN
#define C7SEGRGB_SEVEN
Definition: c7segrgb.h:88
logic_one
void logic_one(void)
Definition: main.c:76
C7SEGRGB_EIGHT
#define C7SEGRGB_EIGHT
Definition: c7segrgb.h:89
C7SEGRGB_TWO
#define C7SEGRGB_TWO
Definition: c7segrgb.h:83
c7segrgb_cfg_t::logic_one
drv_logic_t logic_one
Definition: c7segrgb.h:148
C7SEGRGB_FIVE
#define C7SEGRGB_FIVE
Definition: c7segrgb.h:86
c7segrgb_set_num
void c7segrgb_set_num(c7segrgb_t *ctx, uint8_t character, uint8_t green_brightness, uint8_t red_brightness, uint8_t blue_brightness)
Sets the character and its color function.
application_task
void application_task(void)
Definition: main.c:115
c7segrgb_cfg_t
Click configuration structure definition.
Definition: c7segrgb.h:141
c7segrgb_cfg_t::logic_zero
drv_logic_t logic_zero
Definition: c7segrgb.h:147
C7SEGRGB_ONE
#define C7SEGRGB_ONE
Definition: c7segrgb.h:82
c7segrgb_set_seven_seg
void c7segrgb_set_seven_seg(c7segrgb_t *ctx)
Sets all segments data.
C7SEGRGB_NINE
#define C7SEGRGB_NINE
Definition: c7segrgb.h:90
c7segrgb_init
err_t c7segrgb_init(c7segrgb_t *ctx, c7segrgb_cfg_t *cfg)
Initialization function.
C7SEGRGB_ZERO
#define C7SEGRGB_ZERO
Definition: c7segrgb.h:91
C7SEGRGB_FOUR
#define C7SEGRGB_FOUR
Definition: c7segrgb.h:85
C7SEGRGB_SIX
#define C7SEGRGB_SIX
Definition: c7segrgb.h:87
C7SEGRGB_THREE
#define C7SEGRGB_THREE
Definition: c7segrgb.h:84
C7SEGRGB_POINT
#define C7SEGRGB_POINT
Definition: c7segrgb.h:92
application_init
void application_init(void)
Definition: main.c:94
c7segrgb_cfg_setup
void c7segrgb_cfg_setup(c7segrgb_cfg_t *cfg)
Config Object Initialization function.
c7segrgb_t
Click ctx object definition.
Definition: c7segrgb.h:123
logic_zero
void logic_zero(void)
Definition: main.c:84
C7SEGRGB_MAP_MIKROBUS
#define C7SEGRGB_MAP_MIKROBUS(cfg, mikrobus)
Definition: c7segrgb.h:65