TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (91 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 (139271 times)
  2. FAT32 Library (71756 times)
  3. Network Ethernet Library (57128 times)
  4. USB Device Library (47433 times)
  5. Network WiFi Library (43098 times)
  6. FT800 Library (42409 times)
  7. GSM click (29835 times)
  8. mikroSDK (28104 times)
  9. PID Library (26886 times)
  10. microSD click (26200 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

DIGI POT 5 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.17

mikroSDK Library: 2.0.0.0

Category: Digital potentiometer

Downloaded: 239 times

Not followed.

License: MIT license  

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.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "DIGI POT 5 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "DIGI POT 5 Click" changes.

Do you want to report abuse regarding "DIGI POT 5 Click".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


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.

digipot5_click.png

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 :

  • Configuration Object Setup function.

    void digipot5_cfg_setup( digipot5_cfg_t *cfg );

  • Click Initialization function.

    digipot5_err_t digipot5_init( digipot5_t ctx, digipot5_cfg_t cfg );

  • Click Default Configuration function.

    void digipot5_default_cfg( digipot5_t *ctx );

Example key functions :

  • Generic Write function.

    digipot5_err_t digipot5_generic_write( digipot5_t *ctx, digipot5_reg_t reg_addr, uint16_t data_in );

  • Generic Read function.

    digipot5_err_t digipot5_generic_read( digipot5_t ctx, digipot5_reg_t reg_addr, uint16_t data_out );

  • Increment Wiper function.

    digipot5_reg_t digipot5_increment_wiper( digipot5_t *ctx, digipot5_reg_t reg_addr );

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 );

    /** 
     * 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( 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 );
    digipot5_generic_write( &digipot5, DIGIPOT5_REG_WIPER0_VOL,
                            DIGIPOT5_RES_ZEROSCALE );
    log_write( &console, "* Setting wiper 1 to 3k Ohm.", LOG_FORMAT_LINE );
    digipot5_generic_write( &digipot5, DIGIPOT5_REG_WIPER1_VOL,
                            DIGIPOT5_RES_3KOHM );
    log_write( &console, "* Setting wiper 2 to half scale (5k Ohm).",
               LOG_FORMAT_LINE );
    digipot5_generic_write( &digipot5, DIGIPOT5_REG_WIPER2_VOL,
                            DIGIPOT5_RES_5KOHM_HALFSCALE );
    log_write( &console, "* Setting wiper 3 to full scale (10k Ohm).",
               LOG_FORMAT_LINE );
    digipot5_generic_write( &digipot5, DIGIPOT5_REG_WIPER3_VOL,
                            DIGIPOT5_RES_10KOHM_FULLSCALE );

    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++ )
    {
        digipot5_decrement_wiper( &digipot5, DIGIPOT5_REG_WIPER3_VOL );
    }

    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++ )
    {
        digipot5_increment_wiper( &digipot5, DIGIPOT5_REG_WIPER0_VOL );
    }

    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    log_write( &console, "* Setting wiper 0 to 2k Ohm.", LOG_FORMAT_LINE );
    digipot5_generic_write( &digipot5, DIGIPOT5_REG_WIPER0_VOL,
                            DIGIPOT5_RES_2KOHM );
    log_write( &console, "* Setting wiper 1 to 2k Ohm.", LOG_FORMAT_LINE );
    digipot5_generic_write( &digipot5, DIGIPOT5_REG_WIPER1_VOL,
                            DIGIPOT5_RES_2KOHM );
    log_write( &console, "* Setting wiper 2 to 2k Ohm.", LOG_FORMAT_LINE );
    digipot5_generic_write( &digipot5, DIGIPOT5_REG_WIPER2_VOL,
                            DIGIPOT5_RES_2KOHM );
    log_write( &console, "* Setting wiper 3 to 2k Ohm.", LOG_FORMAT_LINE );
    digipot5_generic_write( &digipot5, DIGIPOT5_REG_WIPER3_VOL,
                            DIGIPOT5_RES_2KOHM );

    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.


ALSO FROM THIS AUTHOR

Inclinometer 3 Click

0

Inclinometer 3 Click is a compact add-on board for precise tilt and leveling measurement applications. This board features the SCL3400-D01, a two-axis inclinometer sensor from Murata, leveraging advanced capacitive 3D-MEMS technology. It features a high-performance mixed-signal ASIC with a flexible SPI digital interface housed in a robust 12-pin pre-molded casing, ensuring long-term reliability and performance.

[Learn More]

XBEE 2 Click

0

Xbee 2 Click is a compact add-on board providing wireless end-point connectivity to other devices. This board features the XB3-24Z8UM, a Digi XBee® 3 transceiver module offering a fully interoperable ecosystem covering all vertical markets from Digi International. Building on industry-leading technology, the pre-certified Digi XBee® 3 module delivers the flexibility to switch between multiple frequencies and wireless protocols as needed (Zigbee, 802.15.4, DigiMesh® and BLE). It can be easily configured and controlled from a simple, central platform and comes with built-in Digi TrustFence® security, identity, and data privacy features which use more than 175 controls to protect against new and evolving cyber threats.

[Learn More]

RS232 to I2C Click

0

RS232 to I2C Click is a compact add-on board representing a universal usable RS232 to I2C converter. This board features the ZDU0110RFX, a bridge between a UART port and an I2C bus from Zilog, which at the same time represents the connection between the MCU and the RS232 line driver and receiver, the MAX3232. The ZDU0110RFX provides full-duplex asynchronous communications with a 128 byte FIFO buffer, of which 64 bytes each are allocated to receive and transmit operations. It also contains a 4kbit EEPROM and GPIO with programmable interrupt capability; programmable interrupts and interrupt lines for UART and GPIO notifications.

[Learn More]