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]
Rating:
Author: MIKROE
Last Updated: 2024-10-31
Package Version: 2.1.0.7
mikroSDK Library: 2.0.0.0
Category: LED Drivers
Downloaded: 105 times
Not followed.
License: MIT license
LED Driver 18 Click is a compact add-on board that simplifies the control of multiple LEDs. This board features the TLC5947, a 24-channel LED driver from Texas Instruments. Each channel is individually adjustable with 4096 pulse-width modulated (PWM) steps and has a programmable current value of all channels with a maximum of 30mA of LED current per channel.
Do you want to subscribe in order to receive notifications regarding "LED Driver 18 Click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "LED Driver 18 Click" changes.
Do you want to report abuse regarding "LED Driver 18 Click".
DOWNLOAD LINK | RELATED COMPILER | CONTAINS |
---|---|---|
5149_led_driver_18_cl.zip [543.89KB] | mikroC AI for ARM GCC for ARM Clang for ARM mikroC AI for PIC mikroC AI for PIC32 XC32 GCC for RISC-V Clang for RISC-V mikroC AI for AVR mikroC AI for dsPIC XC16 |
|
LED Driver 18 Click is a compact add-on board that simplifies the control of multiple LEDs. This board features the TLC5947, a 24-channel LED driver from Texas Instruments. Each channel is individually adjustable with 4096 pulse-width modulated (PWM) steps and has a programmable current value of all channels with a maximum of 30mA of LED current per channel.
We provide a library for the LED Driver 18 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.
This library contains API for LED Driver 18 Click driver.
leddriver18_cfg_setup
Config Object Initialization function.
void leddriver18_cfg_setup ( leddriver18_cfg_t *cfg );
leddriver18_init
Initialization function.
err_t leddriver18_init ( leddriver18_t *ctx, leddriver18_cfg_t *cfg );
leddriver18_default_cfg
Click Default Configuration function.
err_t leddriver18_default_cfg ( leddriver18_t *ctx );
leddriver18_set_output_pwm
LED Driver 18 set output channel PWM value function.
err_t leddriver18_set_output_pwm ( uint8_t out_num, float pwm_val );
leddriver18_write_config
LED Driver 18 write config function.
void leddriver18_write_config ( leddriver18_t *ctx );
leddriver18_set_cc_output
LED Driver 18 set constant current output function.
err_t leddriver18_set_cc_output ( leddriver18_t *ctx, uint8_t current_limit );
This library contains API for LED Driver 18 Click driver. The library initializes and defines the I2C bus drivers to write and read data for setting constant current output, as well as the default configuration for a PWM output value of the OUT pins.
The demo application is composed of two sections :
Initializes the driver and performs default configuration and sets the device in output enabled mode.
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
leddriver18_cfg_t leddriver18_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.
leddriver18_cfg_setup( &leddriver18_cfg );
LEDDRIVER18_MAP_MIKROBUS( leddriver18_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == leddriver18_init( &leddriver18, &leddriver18_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( LEDDRIVER18_ERROR == leddriver18_default_cfg ( &leddriver18 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
This example demonstrates the use of the LED Driver 18 Click board by changing PWM values for all output from a minimum value to maximum value and back to minimum controlling the brightness of the LEDs in the process.
void application_task ( void )
{
float pwm_val;
for ( int8_t n_cnt = 0; n_cnt <= 100; n_cnt += 10 )
{
for ( uint8_t out_cnt = 0; out_cnt < LEDDRIVER18_MAX_OUTPUT_NUM; out_cnt++ )
{
leddriver18_set_output_pwm( out_cnt, n_cnt );
}
pwm_val = leddriver18_get_output_pwm( 0 );
log_printf( &logger, " PWM value: %.2f \r\n", pwm_val );
leddriver18_write_config( &leddriver18 );
Delay_ms ( 200 );
}
for ( int8_t n_cnt = 100; n_cnt >= 10; n_cnt -= 10 )
{
for ( uint8_t out_cnt = 0; out_cnt < LEDDRIVER18_MAX_OUTPUT_NUM; out_cnt++ )
{
leddriver18_set_output_pwm( out_cnt, n_cnt );
}
pwm_val = leddriver18_get_output_pwm( 0 );
log_printf( &logger, " PWM value: %.2f \r\n", pwm_val );
leddriver18_write_config( &leddriver18 );
Delay_ms ( 200 );
}
}
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:
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.