Intermediate
30 min

Bring your signals to life with AD7175-8 and PIC24FV16KA304

Unlock the digital dimension

ADC 4 Click with EasyPIC v8 for PIC24/dsPIC33

Published 11月 01, 2023

Click board™

ADC 4 Click

Dev Board

EasyPIC v8 for PIC24/dsPIC33

Compiler

NECTO Studio

MCU

PIC24FV16KA304

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

EasyPIC v8 for PIC24/dsPIC33 is a development board specially designed for the needs of rapid development of embedded applications. It supports a wide range of 16-bit PIC24/dsPIC33 microcontrollers from Microchip and has a broad set of unique functions, such as the first-ever embedded debugger/programmer. 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 v8 for PIC24/dsPIC33 provides a fluid and immersive working experience, allowing access anywhere and under any circumstances. Each part of the EasyPIC

v8 for PIC24/dsPIC33 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 HOST/DEVICE, USB-UART, CAN, and LIN are also

included, including the well-established mikroBUS™ standard, two display options (graphical and character-based LCD), and several different DIP sockets. These sockets cover a wide range of 16-bit PIC24/dsPIC33 MCUs, from the smallest PIC24/dsPIC33 MCUs with only 14 up to 28 pins. EasyPIC v8 for PIC24/dsPIC33 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.

EasyPIC v8 for PIC24/dsPIC33 horizontal image

Microcontroller Overview

MCU Card / MCU

default

Architecture

dsPIC

MCU Memory (KB)

16

Silicon Vendor

Microchip

Pin count

28

RAM (Bytes)

2048

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
NC
NC
RST
SPI Chip Select
RA4
CS
SPI Clock
RB7
SCK
SPI Data OUT
RB9
MISO
SPI Data IN
RB8
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Error Signal
RB7
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

EasyPIC v8 for PIC24/dsPIC33 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the EasyPIC v8 for PIC24/dsPIC33 as your development board.

EasyPIC v8 for PIC24/dsPIC33 front image hardware assembly
GNSS2 Click front image hardware assembly
MCU DIP 28 hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
EasyPIC PIC24/dsPIC33 v8 Access DIP 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 Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto DIP image step 7 hardware assembly
Necto image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware 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

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

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

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

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