Help electronics understand and work with information from the real world
A
A
Hardware Overview
How does it work?
ADC Click is based on the MCP3204, a 4-channel 12-bit A/D converter with SPI serial interface from Microchip. The MCP3204 contains an input channel selection multiplexer (CH0, CH1, CH2, CH3) which for reference can use the VCC (3.3V or 5V) or a 4.096V of the MCP1541 voltage reference from Microchip. The voltage reference determines the analog voltage range and can be selected via REFERENCE onboard jumper. To connect the
analog voltages to the ADC Click, utilize the four labeled terminals CH0-3 along with two GND terminals for referencing the ground. Each analog input pin goes through the MCP6284, a 5MHz rail-to-rail OpAmp from Microchip. The ADC Click uses a standard 4-Wire SPI serial interface to communicate with the host MCU, supporting both 0 and 3 of the SPI modes and operating at clock rates of up to 2MHz. Communication with the ADC
Click is initiated by bringing the CS line LOW. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the PWR SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. However, the 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
PIC18F57Q43 Curiosity Nano evaluation kit is a cutting-edge hardware platform designed to evaluate microcontrollers within the PIC18-Q43 family. Central to its design is the inclusion of the powerful PIC18F57Q43 microcontroller (MCU), offering advanced functionalities and robust performance. Key features of this evaluation kit include a yellow user LED and a responsive
mechanical user switch, providing seamless interaction and testing. The provision for a 32.768kHz crystal footprint ensures precision timing capabilities. With an onboard debugger boasting a green power and status LED, programming and debugging become intuitive and efficient. Further enhancing its utility is the Virtual serial port (CDC) and a debug GPIO channel (DGI
GPIO), offering extensive connectivity options. Powered via USB, this kit boasts an adjustable target voltage feature facilitated by the MIC5353 LDO regulator, ensuring stable operation with an output voltage ranging from 1.8V to 5.1V, with a maximum output current of 500mA, subject to ambient temperature and voltage constraints.
Microcontroller Overview
MCU Card / MCU
Architecture
PIC
MCU Memory (KB)
128
Silicon Vendor
Microchip
Pin count
48
RAM (Bytes)
8196
You complete me!
Accessories
Curiosity Nano Base for Click boards is a versatile hardware extension platform created to streamline the integration between Curiosity Nano kits and extension boards, tailored explicitly for the mikroBUS™-standardized Click boards and Xplained Pro extension boards. This innovative base board (shield) offers seamless connectivity and expansion possibilities, simplifying experimentation and development. Key features include USB power compatibility from the Curiosity Nano kit, alongside an alternative external power input option for enhanced flexibility. The onboard Li-Ion/LiPo charger and management circuit ensure smooth operation for battery-powered applications, simplifying usage and management. Moreover, the base incorporates a fixed 3.3V PSU dedicated to target and mikroBUS™ power rails, alongside a fixed 5.0V boost converter catering to 5V power rails of mikroBUS™ sockets, providing stable power delivery for various connected devices.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project 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.
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™.
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.
Software Support
Library Description
This library contains API for ADC Click driver.
Key functions:
adc_get_single_ended_ch
- Get Single-Ended Channel functionadc_get_differential_ch
- Get Pseudo-Differential Pair 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 ADC Click example
*
* # Description
* This example demonstrates the use of ADC Click board.
* The all channels can be configured as single-ended or pseudo-differential
* pair.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes SPI driver, performs the reference voltage selection and
* initializes UART console for results logging.
*
* ## Application Task
* Reads voltage level of channels 0 and 1 in the both configurations,
* single-ended and pseudo-differential pair, every 1 second.
* All channels results will be calculated to millivolts [mV].
*
* *note:*
* In single-ended mode the all channels must be in the range from Vss (GND)
* to Vref (3V3 by default).
* In pseudo-differential mode the IN- channel must be in the range from
* (Vss - 100mV) to (Vss + 100mV). The IN+ channel must be in the range from
* IN- to (Vref + IN-).
* If any of conditions are not fullfilled, the device will return 0 or Vref
* voltage level, and measurements are not valid.
*
* \author Nemanja Medakovic
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "adc.h"
// ------------------------------------------------------------------ VARIABLES
static adc_t adc;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init( void )
{
log_cfg_t log_cfg;
adc_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.
adc_cfg_setup( &cfg );
ADC_MAP_MIKROBUS( cfg, MIKROBUS_1 );
adc_init( &adc, &cfg );
}
void application_task( void )
{
adc_get_single_ended_ch( &adc, ADC_CH0_OR_CH01 );
adc_get_single_ended_ch( &adc, ADC_CH1_OR_CH10 );
adc_get_single_ended_ch( &adc, ADC_CH2_OR_CH23 );
adc_get_single_ended_ch( &adc, ADC_CH3_OR_CH32 );
adc_get_differential_ch( &adc, ADC_CH0_OR_CH01 );
log_printf( &logger, "* CH0 = %u mV\r\n", adc.ch0 );
log_printf( &logger, "* CH1 = %u mV\r\n", adc.ch1 );
log_printf( &logger, "* CH2 = %u mV\r\n", adc.ch2 );
log_printf( &logger, "* CH3 = %u mV\r\n", adc.ch3 );
log_printf( &logger, "* CH0 - CH1 = %d mV\r\n", adc.ch01 );
log_printf( &logger, "-----------------------------\r\n" );
Delay_ms( 1000 );
}
void main( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END