Maximize the potential of your electronic circuits by unlocking unparalleled precision with our digital potentiometer – the key to achieving peak performance and efficiency in every application.
A
A
Hardware Overview
How does it work?
DIGI POT 12 Click is based on the AD5142A, a dual-channel, 256-position nonvolatile digital potentiometer from Analog Devices. The resistor wiper position is determined by the RDAC register contents, which act as a scratchpad register, allowing unlimited changes of resistance settings. The scratchpad register can be programmed with any position setting using the standard I2C interface by loading the 16-bit data word. The nominal resistance of the RDAC between terminals A and terminals B (RAB) is 10KΩ with 8-bit RDAC latch data decoded to select one of the 256 possible wiper settings. When a desired position is found, this value can be stored in the onboard EEPROM memory; thus, the wiper position is always restored for subsequent power-ups. The EEPROM data can be read back, written
independently, and protected by software. This Click board™ communicates with MCU through a standard 2-Wire I2C interface and operates at Standard (100KHz) and Fast (400KHz) data transfer modes. The I2C address can be selected via the ADDR SEL jumpers with 0 selected by default. There is an RST pin for resetting the digital potentiometers RDAC registers from EEPROM, with active LOW logic. In addition, this Click board™ comes with the INDEP SEL jumper that allows you to choose between the potentiometer and the linear gain setting mode, with the potentiometer mode set by default (0). The linear gain setting mode of operation can control the potentiometer as two independent rheostats connected at a single point. Once the jumper is set, it can not be turned off by software. In
addition, there is a burst mode in which multiple data bytes can be sent to the host MCU. The Shutdown mode places the RDAC in a zero power consumption while the data in EEPROM remains. There is no polarity constraint between the B, W, and A on both terminals, but they can not be higher than the VCC (5V maximum) nor lower than the VSS (0V). This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.
Features overview
Development board
EasyPIC PRO v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports many high pin count 8-bit PIC microcontrollers from Microchip, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer over WiFi. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, EasyPIC PRO v8 provides a fluid and immersive working experience, allowing access anywhere and under
any circumstances at any time. Each part of the EasyPIC PRO v8 development board contains the components necessary for the most efficient operation of the same board. In addition to the advanced integrated CODEGRIP programmer/debugger module, which offers many valuable programming/debugging options and seamless integration with the Mikroe software environment, the board also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.
Communication options such as USB-UART, USB DEVICE, and Ethernet are also included, including the well-established mikroBUS™ standard, a standardized socket for the MCU card (SiBRAIN standard), and two display options (graphical and character-based LCD). EasyPIC PRO v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.
Microcontroller Overview
MCU Card / MCU
![default](https://cdn.mikroe.com/rent-a-product/request-setup/mcu-cards/mcu-card-7-for-pic-pic18f87j50.png)
Type
8th Generation
Architecture
PIC
MCU Memory (KB)
128
Silicon Vendor
Microchip
Pin count
80
RAM (Bytes)
3904
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
![DIGI POT 12 Click Schematic schematic](https://dbp-cdn.mikroe.com/catalog/click-boards/resources/1ee7f025-d702-6852-b57c-0242ac120003/digi-pot-12-click-v100-Schematic-1.png)
Step by step
Project assembly
Track your results in real time
Application Output
After pressing the "FLASH" button on the left-side panel, it is necessary to open the UART terminal to display the achieved results. By clicking on the Tools icon in the right-hand panel, multiple different functions are displayed, among which is the UART Terminal. Click on the offered "UART Terminal" icon.
![UART Application Output Step 1](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed703a-40a0-6b58-88de-02420a00029a/UART-AO-Step-1.jpg)
Once the UART terminal is opened, the window takes on a new form. At the top of the tab are two buttons, one for adjusting the parameters of the UART terminal and the other for connecting the UART terminal. The tab's lower part is reserved for displaying the achieved results. Before connecting, the terminal has a Disconnected status, indicating that the terminal is not yet active. Before connecting, it is necessary to check the set parameters of the UART terminal. Click on the "OPTIONS" button.
![UART Application Output Step 2](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed703a-eb29-62fa-ba91-02420a00029a/UART-AO-Step-2.jpg)
In the newly opened UART Terminal Options field, we check if the terminal settings are correct, such as the set port and the Baud rate of UART communication. If the data is not displayed properly, it is possible that the Baud rate value is not set correctly and needs to be adjusted to 115200. If all the parameters are set correctly, click on "CONFIGURE".
![UART Application Output Step 3](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed703b-7543-6fbc-9c69-0242ac120003/UART-AO-Step-3.jpg)
The next step is to click on the "CONNECT" button, after which the terminal status changes from Disconnected to Connected in green, and the data is displayed in the Received data field.
![UART Application Output Step 4](https://dbp-cdn.mikroe.com/cms/shared-resources/1eed703c-068c-66a4-a4fc-0242ac120003/UART-AO-Step-4.jpg)
Software Support
Library Description
This library contains API for DIGI POT 12 Click driver.
Key functions:
digipot12_set_resistance
- DIGI POT 12 set the resistance function.digipot12_get_resistance
- DIGI POT 12 get the resistance function.
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* @file main.c
* @brief DIGI POT 12 Click example
*
* # Description
* This library contains API for DIGI POT 12 Click driver.
* The demo application uses a digital potentiometer
* to change the resistance values of both channels.
*
* The demo application is composed of two sections :
*
* ## Application Init
* The initialization of I2C module, log UART, and additional pins.
* After the driver init, the app executes a default configuration.
*
* ## Application Task
* This example demonstrates the use of the DIGI POT 12 Click board™.
* The demo application iterates through the entire wiper range and
* sets the resistance of both channels in steps of approximately 1kOhm.
* Results are being sent to the UART Terminal, where you can track their changes.
*
* @author Nenad Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "digipot12.h"
static digipot12_t digipot12;
static log_t logger;
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
digipot12_cfg_t digipot12_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.
digipot12_cfg_setup( &digipot12_cfg );
DIGIPOT12_MAP_MIKROBUS( digipot12_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == digipot12_init( &digipot12, &digipot12_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( DIGIPOT12_ERROR == digipot12_default_cfg ( &digipot12 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
log_printf( &logger, " ----------------------------\r\n" );
Delay_ms( 100 );
}
void application_task ( void )
{
static float res_kohm;
for ( uint8_t n_cnt = DIGIPOT12_RES_0_KOHM; n_cnt <= DIGIPOT12_RES_10_KOHM; n_cnt++ )
{
if ( DIGIPOT12_OK == digipot12_set_resistance( &digipot12, DIGIPOT12_WIPER_SEL_1, ( float ) n_cnt ) )
{
if ( DIGIPOT12_OK == digipot12_get_resistance( &digipot12, DIGIPOT12_WIPER_SEL_1, &res_kohm ) )
{
log_printf( &logger, " Rwb1 : %.2f kOhm\r\n", res_kohm );
Delay_ms( 100 );
}
}
if ( DIGIPOT12_OK == digipot12_set_resistance( &digipot12, DIGIPOT12_WIPER_SEL_2, ( float ) ( DIGIPOT12_RES_10_KOHM - n_cnt ) ) )
{
if ( DIGIPOT12_OK == digipot12_get_resistance( &digipot12, DIGIPOT12_WIPER_SEL_2, &res_kohm ) )
{
log_printf( &logger, " Rwb2 : %.2f kOhm\r\n", res_kohm );
Delay_ms( 100 );
}
}
log_printf( &logger, " ----------------------------\r\n" );
Delay_ms( 5000 );
}
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END