digipot5  2.0.0.0
Main Page

DIGI POT 5 click

DIGI POT 5 click is a digitally controlled quad potentiometer, with the resistance of 10KΩ. It has an 8bit wiper step resolution, which allows the wiper to take 257 different discrete positions (across 256 internal resistors). The digital wiper position can be controlled via the SPI interface.

click Product page


Click library

  • Author : Nemanja Medakovic
  • Date : Nov 2019.
  • Type : SPI type

Software Support

We provide a library for the DigiPot5 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 DIGI POT 5 Click driver.

Standard key functions :

Example key functions :

Examples Description

This example demonstrates the use of the DIGI POT 5 click board.

The demo application is composed of two sections :

Application Init

Initializes all necessary peripherals and pins used for the DIGI POT 5 click. Also allows the device to be reset and configured to enable all wipers (4). UART console module will be initialized also in this function.

void application_init( void )
{
digipot5_cfg_t digipot5_cfg;
log_cfg_t console_cfg;
// Click initialization.
digipot5_cfg_setup( &digipot5_cfg );
DIGIPOT5_MAP_MIKROBUS( digipot5_cfg, MIKROBUS_1 );
digipot5_init( &digipot5, &digipot5_cfg );
digipot5_reset( &digipot5 );
digipot5_default_cfg( &digipot5 );
LOG_MAP_USB_UART( console_cfg );
log_init( &console, &console_cfg );
log_write( &console, "*** DIGI POT 5 Initialization Done ***",
LOG_FORMAT_LINE );
log_write( &console, "****************************************",
LOG_FORMAT_LINE );
}

Application Task

Demonstrates the use of click driver functions by performing a control of the all wipers positions. By checking the uart console, user can be informed about the all current wipers positions.

void application_task( void )
{
log_write( &console, "* Setting wiper 0 to zero scale.", LOG_FORMAT_LINE );
log_write( &console, "* Setting wiper 1 to 3k Ohm.", LOG_FORMAT_LINE );
log_write( &console, "* Setting wiper 2 to half scale (5k Ohm).",
LOG_FORMAT_LINE );
log_write( &console, "* Setting wiper 3 to full scale (10k Ohm).",
LOG_FORMAT_LINE );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_write( &console, "* Decrementing wiper 3 by 5 steps.",
LOG_FORMAT_LINE );
for ( i = 0; i < 5; i++ )
{
}
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_write( &console, "* Incrementing wiper 0 by 10 steps.",
LOG_FORMAT_LINE );
for ( i = 0; i < 10; i++ )
{
}
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_write( &console, "* Setting wiper 0 to 2k Ohm.", LOG_FORMAT_LINE );
log_write( &console, "* Setting wiper 1 to 2k Ohm.", LOG_FORMAT_LINE );
log_write( &console, "* Setting wiper 2 to 2k Ohm.", LOG_FORMAT_LINE );
log_write( &console, "* Setting wiper 3 to 2k Ohm.", LOG_FORMAT_LINE );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_write( &console, "****************************************",
LOG_FORMAT_LINE );
}

Note

Increment/decrement command can be issued only to volatile wiper locations.

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.DigiPot5

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.


digipot5_init
digipot5_err_t digipot5_init(digipot5_t *ctx, digipot5_cfg_t *cfg)
Click Initialization function.
digipot5_increment_wiper
digipot5_reg_t digipot5_increment_wiper(digipot5_t *ctx, digipot5_reg_t reg_addr)
Increment Wiper function.
digipot5_reset
void digipot5_reset(digipot5_t *ctx)
Reset function.
DIGIPOT5_RES_5KOHM_HALFSCALE
#define DIGIPOT5_RES_5KOHM_HALFSCALE
Definition: digipot5.h:78
DIGIPOT5_RES_2KOHM
#define DIGIPOT5_RES_2KOHM
Definition: digipot5.h:76
application_task
void application_task(void)
Definition: main.c:68
digipot5_cfg_t
Click configuration structure definition.
Definition: digipot5.h:159
DIGIPOT5_RES_3KOHM
#define DIGIPOT5_RES_3KOHM
Definition: digipot5.h:77
DIGIPOT5_REG_WIPER0_VOL
@ DIGIPOT5_REG_WIPER0_VOL
Definition: digipot5.h:120
DIGIPOT5_MAP_MIKROBUS
#define DIGIPOT5_MAP_MIKROBUS(cfg, mikrobus)
Definition: digipot5.h:88
DIGIPOT5_REG_WIPER1_VOL
@ DIGIPOT5_REG_WIPER1_VOL
Definition: digipot5.h:121
digipot5_cfg_setup
void digipot5_cfg_setup(digipot5_cfg_t *cfg)
Configuration Object Setup function.
DIGIPOT5_REG_WIPER3_VOL
@ DIGIPOT5_REG_WIPER3_VOL
Definition: digipot5.h:127
DIGIPOT5_RES_10KOHM_FULLSCALE
#define DIGIPOT5_RES_10KOHM_FULLSCALE
Definition: digipot5.h:81
digipot5_generic_write
digipot5_err_t digipot5_generic_write(digipot5_t *ctx, digipot5_reg_t reg_addr, uint16_t data_in)
Generic Write function.
application_init
void application_init(void)
Definition: main.c:41
digipot5_default_cfg
void digipot5_default_cfg(digipot5_t *ctx)
Click Default Configuration function.
digipot5_decrement_wiper
digipot5_reg_t digipot5_decrement_wiper(digipot5_t *ctx, digipot5_reg_t reg_addr)
Decrement Wiper function.
DIGIPOT5_RES_ZEROSCALE
#define DIGIPOT5_RES_ZEROSCALE
Definition: digipot5.h:74
DIGIPOT5_REG_WIPER2_VOL
@ DIGIPOT5_REG_WIPER2_VOL
Definition: digipot5.h:126