How does it work?
ADC 20 Click is based on the TLA2518, a small, eight-channel, multiplexed, 12-bit, 1-MSPS, analog-to-digital converter (ADC) from Texas Instruments. The TLA2518 comes with an internal oscillator for the ADC conversion process and supports averaging multiple data samples with a single conversion start. Also, the built-in programmable averaging filters, which output a 16-bit result for enhanced resolution, help reduce noise from the analog inputs and the number of data samples required to be read by the host MCU. The analog input channel selection can be auto-sequenced to simplify the digital interface with the host MCU.
This Click board™ communicates with MCU through a standard SPI interface, supporting all four SPI-compatible protocols (SPI Mode 0, 1, 2, and 3) to access the device, and operates at clock rates up to 60MHz for all configurations and information management and acquiring conversion results. As mentioned before, the TLA2518 powers up in Manual mode and can be configured into either of three operational modes by writing the configuration registers for the desired mode.
The Manual mode allows the host MCU to directly select the analog input channel, while in the second, the On-the-Fly mode of operation, the analog input channel is set using the first five bits on the SDI signal without waiting for the CS rising edge. This way, the ADC samples the newly selected channel on the CS edge, and there is no latency between the channel selection and the ADC output data. In the third Auto-Sequence mode, the internal channel sequencer switches the multiplexer to the next analog input channel after every conversion.
In addition to the fact that all eight channels, including also channels on the side headers, can be used as analog input pins, this board allows for some channels, in this case, channels CH0, CH1, CH6, and CH7 of the TLA2518 to be configured as digital inputs, open-drain digital outputs, and push-pull digital outputs.
This Click board™ can operate with both 3.3V and 5V logic voltage levels selected via the VCC SEL jumper. This way, it is allowed for both 3.3V and 5V capable MCUs to 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.
Specifications
Type
ADC
Applications
Can be used from general-purpose remote data acquisition to industrial applications
On-board modules
TLA2518 – analog-to-digital converter (ADC) from Texas Instruments
Key Features
Eight user-configurable channels, open-drain, push-pull digital outputs, wide operating ranges, SPI serial interface, high speed, high performance, high resolution, programmable averaging filters, and more
Interface
SPI
Feature
ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on ADC 20 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
ADC 20 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Resolution | – | 12 | 16 | bits |
Sampling Rate | – | – | 1000 | kSPS |
Software Support
We provide a library for the ADC 20 Click as well as a demo application (example), developed using Mikroe compilers. The demo can run on all the main Mikroe development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for ADC 20 Click driver.
Key functions
-
adc20_read_data
This function reads two bytes of data by using SPI serial interface. -
adc20_set_gpo_value
This function sets the gpo value for the selected channels. -
adc20_read_gpio_value
This function reads the gpio pins value.
Example Description
This example demonstrates the use of ADC 20 Click board™ by displaying the state of 8 channels configured as analog inputs (CH2-CH5), digital inputs (CH0-CH1) and digital outputs (CH6-CH7).
void application_task ( void )
{
adc20_start_auto_sequence ( &adc20 );
for ( uint8_t ch_id = ADC20_CHANNEL_ID_2; ch_id <= ADC20_CHANNEL_ID_5; ch_id++ )
{
uint16_t adc_data = 0;
if ( ADC20_OK == adc20_read_data ( &adc20, &adc_data ) )
{
float voltage = ( float ) ( adc_data >> ADC20_ADC_OFFSET ) / ADC20_RES_12BIT * ADC20_VREF_3V3;
log_printf ( &logger, " AIN%u: %.2f Vrn", ( adc_data & ADC20_CHANNEL_ID_MASK ), voltage );
}
}
adc20_stop_auto_sequence ( &adc20 );
static uint8_t out_logic_state = ADC20_GPIO_VALUE_LOW;
if ( ADC20_OK == adc20_set_gpo_value ( &adc20, ( ADC20_CHANNEL_6 | ADC20_CHANNEL_7 ), out_logic_state ) )
{
uint8_t gpio_value = 0;
if ( ADC20_OK == adc20_read_gpio_value ( &adc20, &gpio_value ) )
{
log_printf ( &logger, " GPIO state: 0x%.2Xrn", gpio_value );
}
}
out_logic_state = !out_logic_state;
log_printf ( &logger, "rn" );
Delay_ms ( 1000 );
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.ADC20
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. UART terminal is available in all Mikroe compilers.
mikroSDK
This Click board™ is supported with mikroSDK – Mikroe Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.