Intermediate
30 min

Bring your signals to life with AD7175-8 and PIC18F57K42

Unlock the digital dimension

ADC 4 Click with UNI Clicker

Published Jun 08, 2023

Click board™

ADC 4 Click

Dev Board

UNI Clicker

Compiler

NECTO Studio

MCU

PIC18F57K42

Transform your designs with the accuracy and reliability of our Analog-To-Digital converter

A

A

Hardware Overview

How does it work?

ADC 4 Click is based on the AD7175-8 IC, a 24bit low noise, fast settling, multiplexed 8/16-channel sigma-delta analog-to-digital converter from Analog Devices. This integrated circuit allows for several different working modes and input connection configurations, giving much flexibility to work with. The ADC 4 Click can work in 16-bit or 24-bit mode, depending on the required precision. It can use single-ended connections with one common pin or differential pair connections, allowing for any combination between the two types of inputs. The AD7175-8 features analog and digital signal conditioning blocks; every channel can be individually set up to use them. Some of these features include various filters (sinc3, sinc5 + sinc1, enhanced 50/60Hz filters), adjustable gain, offset, and more. Besides the 16 input channel registers used to turn the channel off or on and select the differential pairs, there are also 8 "setups" consisting of four registers. Each setup contains one setup config register, filter, gain, and offset register. These registers adjust various conversion settings, such as the reference voltage source, filter type, the buffers on the input channels, the output sample rate, offset and gain for the channels, and more. Although there are only eight setups, the same setup can be applied to several input channels. This simplifies and speeds up the input channel configuration. The input channels are connected to the ADC via the internal crosspoint multiplexer. This multiplexer is used to select the channel connected to the converter.

If more than one input channel is enabled, the multiplexer will cycle through all the enabled inputs automatically. Depending on the selected operational mode, it will stop or continuously cycle through these channels. It has a maximum channel scan rate of 50 kSPS (20 μs) on multiple channels or 250 kSPS (20 μs) on a single channel for fully settled data. The Click board™ uses the SPI interface for communication with the MCU. The MISO line of the mikroBUS™ is routed to the DOUT/RDY pin of the ADC, and besides the SPI data output, it is also used as the indicator of the ready status of the sampled data: whenever the data is ready to be read, this pin is pulled low. More information about properly reading data from the ADC can be found in the AD7175-8 datasheet. Also, MIKROE provides libraries that allow simple and easy reading of the data registers, as demonstrated in the provided demo application. Besides the SPI lines, the #ERROR line is also routed to the INT pin of the mikroBUS™. The config register can set the behavior of this pin. In addition to being the #ERROR output, this pin can also be configured as the input pin, which can be used for stacking error signals from other devices. In this case, the error is signalized by the appropriate bit in the status register. This pin can also be used as the GPIO for some custom user-defined functions. To further improve the sampling accuracy and reliability, the AD7175-8 IC features a temperature sensor. This sensor can be used to measure the ambient temperature.

For example, if the ambient temperature changes significantly, invoking a recalibration routine is possible, providing continuous reliability over different temperature ranges. The temperature sensor can be selected the same way as any other channel by the crosspoint multiplexer. Besides the reference voltage provided by the AD7175-8's integrated LDO, an external LDO can also be used as a reference voltage source, the LT6656 from Analog Devices, a precise voltage regulator that provides low noise and low drop-out voltage reference of 4.096V. Switching the position of the VREF SMD jumper makes it possible to change the external reference voltage applied to the REF+ pin of the ADC between 2.5V and 4.096V. REF- pin is hardwired to the GND. The ADC can also use a custom voltage reference on the REF2+ and REF2- inputs, multiplexed with the AIN0 (A0) and AIN1 (A1) input pins. Finally, the desired reference voltage source can be selected by setting the appropriate bits in the configuration registers of the AD7175-8. The voltage level of the logic section can be selected via the IOVDD SMD jumper between 3.3V and 5V. This allows both 3.3V and 5V capable MCUs to properly use the SPI communication lines. The IOVDD is 3.3V by default, but the device requires 5V from the mikroBUS™ for proper operation. All input channels can be easily connected to the two nine-pole spring action block terminals without additional tools, such as screwdrivers. 

ADC 4 Click hardware overview image

Features overview

Development board

UNI Clicker is a compact development board designed as a complete solution that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It supports a wide range of microcontrollers, such as different ARM, PIC32, dsPIC, PIC, and AVR from various vendors like Microchip, ST, NXP, and TI (regardless of their number of pins), four mikroBUS™ sockets for Click board™ connectivity, a USB connector, LED indicators, buttons, a debugger/programmer connector, and two 26-pin headers for interfacing with external electronics. Thanks to innovative manufacturing technology, it allows you to build

gadgets with unique functionalities and features quickly. Each part of the UNI Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the UNI Clicker programming method, using a third-party programmer or CODEGRIP/mikroProg connected to onboard JTAG/SWD header, the UNI Clicker board also includes a clean and regulated power supply module for the development kit. It provides two ways of board-powering; through the USB Type-C (USB-C) connector, where onboard voltage regulators provide the appropriate voltage levels to each component on the board, or using a Li-Po/Li

Ion battery via an onboard battery connector. All communication methods that mikroBUS™ itself supports are on this board (plus USB HOST/DEVICE), including the well-established mikroBUS™ socket, a standardized socket for the MCU card (SiBRAIN standard), and several user-configurable buttons and LED indicators. UNI Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

UNI clicker double image

Microcontroller Overview

MCU Card / MCU

default

Type

8th Generation

Architecture

PIC

MCU Memory (KB)

128

Silicon Vendor

Microchip

Pin count

48

RAM (Bytes)

8192

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
NC
NC
RST
SPI Chip Select
PE0
CS
SPI Clock
PC3
SCK
SPI Data OUT
PC4
MISO
SPI Data IN
PC5
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Error Signal
PA0
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Schematic

ADC 4 Click Schematic schematic

Step by step

Project assembly

UNI Clicker front image hardware assembly

Start by selecting your development board and Click board™. Begin with the UNI Clicker as your development board.

UNI Clicker front image hardware assembly
GNSS2 Click front image hardware assembly
SiBRAIN for STM32F745VG front image hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
UNI Clicker Access MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Necto image step 7 hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.

Application Output Step 1

After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.

Application Output Step 3

Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.

Application Output Step 4

Software Support

Library Description

This library contains API for ADC 4 Click driver.

Key functions:

  • adc4_get_err_pin Error check function

  • adc4_get_config Get configuration function

  • adc4_get_voltage Get voltage 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 
 * \brief Adc4 Click example
 * 
 * # Description
 * This application is a converter from analog to digital multichannel 
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes ADC 4 driver and setups working mode.
 * 
 * ## Application Task  
 * Sequential read of voltage. Information about
 * current voltage is logget to UART. Operation is repeated each second. Settings are set
 * to calculate and convert input voltage from CH0 with external referent voltage set by VREF jumper on the click board.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "adc4.h"

// ------------------------------------------------------------------ VARIABLES

static adc4_t adc4;
static log_t logger;
static uint16_t voltage;

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;
    adc4_cfg_t cfg;

    /** 
     * 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.

    adc4_cfg_setup( &cfg );
    ADC4_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    adc4_init( &adc4, &cfg );

    Delay_ms( 100 );

    adc4_default_cfg( &adc4 );

    voltage = 0;
}

void application_task ( )
{
    voltage = adc4_get_voltage( &adc4, ADC4_VREF_4000MV);

    if ( adc4.sing_bit == 1 )
    {
        log_printf( &logger, "Voltage at CH0 : %d mV \r\n", voltage );
    }
    else
    {
        log_printf( &logger, "Voltage at CH0 : - %d mV \r\n", voltage );
    }

    Delay_ms( 1000 );
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

// ------------------------------------------------------------------------ END

Additional Support

Resources