- CIC Prefix : DIGIPOT4
- Author : MikroE Team
- Verison : 1.0.0
- Date : Jan 2018.
We provide a library for the DIGIPOT4 Click on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
Library carries two functions which are enough to have complete control ove DIGIPOT4 click board.
Key functions :
void digipot4_writeReg(uint8_t Reg, uint16_t value)
- Write data to wiper registervoid digipot4_copyReg(uint8_t Reg)
- Copy data to NV memory
Examples Description
The application is composed of three sections :
- System Initialization - Intializes SPI module and set CS pin as OUTPUT
- Application Initialization - DIGIPOT 4 Driver intialization
- Application Task - (code snippet) - Set the wiper position sequentialy each one second.
void applicationTask()
{
digipot4_writeReg(_DIGIPOT4_WIPER_REG_1, 0);
digipot4_writeReg(_DIGIPOT4_WIPER_REG_2, 0);
Delay_1sec();
digipot4_writeReg(_DIGIPOT4_WIPER_REG_1, 512);
digipot4_writeReg(_DIGIPOT4_WIPER_REG_2, 512);
Delay_1sec();
digipot4_writeReg(_DIGIPOT4_WIPER_REG_1, 1023);
digipot4_writeReg(_DIGIPOT4_WIPER_REG_2, 1023);
Delay_1sec();
}
The full application code, and ready to use projects can be found on our LibStock page.
mikroE Libraries used in the example:
- SPI