AD-SWIO 3 click
AD-SWIO 3 Click is a compact add-on board representing a software configurable input/output solution for various purposes. This board features the AD74115H, a single-channel, software-configurable input and output with HART mode from Analog Devices. It provides many functionality for analog input, analog output, digital input, digital output, 2-wire, 3-wire, and 4-wire resistance temperature detector (RTD), and thermocouple measurement capability. The supply power and isolation part are managed by the ADP1034, a 3-channel isolated micropower management unit with seven digital isolators and programmable power control, also from Analog Devices.
click Product page
Click library
- Author : Nenad Filipovic
- Date : Oct 2023.
- Type : SPI type
Software Support
We provide a library for the AD-SWIO 3 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for AD-SWIO 3 Click driver.
Standard key functions :
adswio3_cfg_setup
Config Object Initialization function.
void adswio3_cfg_setup(adswio3_cfg_t *cfg)
AD-SWIO 3 configuration object setup function.
AD-SWIO 3 Click configuration object.
Definition adswio3.h:445
adswio3_init
Initialization function.
err_t adswio3_init(adswio3_t *ctx, adswio3_cfg_t *cfg)
AD-SWIO 3 initialization function.
AD-SWIO 3 Click context object.
Definition adswio3.h:423
adswio3_default_cfg
Click Default Configuration function.
err_t adswio3_default_cfg(adswio3_t *ctx)
AD-SWIO 3 default configuration function.
Example key functions :
adswio3_get_voltage_input
This function reads the raw ADC value and converts them to a proportional voltage level measured by the voltage between the I/OP and I/ON screw terminals.
err_t adswio3_get_voltage_input(adswio3_t *ctx, uint8_t adc_sel, float *voltage)
AD-SWIO 3 gets the voltage input function.
adswio3_get_diag_res
This function is used to read the desired diagnostic conversion results.
err_t adswio3_get_diag_res(adswio3_t *ctx, uint8_t diag_sel, uint16_t *adc_diag_data)
AD-SWIO 3 gets the diagnostic conversion results function.
adswio3_set_adc_cnv
This function is used to control the ADC conversions that must be performed.
err_t adswio3_set_adc_cnv(adswio3_t *ctx, adswio3_adc_cnv_ctrl_t adc_cnv_ctrl)
AD-SWIO 3 ADC conversion control function.
AD-SWIO 3 Click ADC conversion control object.
Definition adswio3.h:498
Example Description
This library contains API for the AD-SWIO 3 Click driver for measurements of the analog output, analog input, digital input, resistance temperature detector (RTD), and thermocouple measurements.
The demo application is composed of two sections :
Application Init
Initialization of SPI and log UART. After driver initialization, the app executes a default configuration that enables and sets it to measure IOP/ION voltage input from 0V to 12V, with 4.8k SPS and enabled four diagnostics measurements (AVDD, VASS, VACC and LVIN).
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( SPI_MASTER_ERROR ==
adswio3_init( &adswio3, &adswio3_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
Delay_ms ( 100 );
{
{
log_error( &logger, " Set GPIO configuration. " );
for ( ; ; );
}
Delay_ms ( 100 );
}
float diag_vtg = 0;
log_printf( &logger, "_________________________\r\n" );
log_printf( &logger, " > Diagnostic Voltages <\r\n" );
{
log_printf( &logger, " AVDD: %.2f V\r\n", diag_vtg );
Delay_ms ( 100 );
}
{
log_printf( &logger, " VASS: %.2f V\r\n", diag_vtg );
Delay_ms ( 100 );
}
{
log_printf( &logger, " VACC: %.2f V\r\n", diag_vtg );
Delay_ms ( 100 );
}
{
log_printf( &logger, " LVIN: %.2f V\r\n", diag_vtg );
Delay_ms ( 100 );
}
log_printf( &logger, "_________________________\r\n" );
Delay_ms ( 1000 );
}
@ ADSWIO3_ERROR
Definition adswio3.h:563
@ ADSWIO3_OK
Definition adswio3.h:562
#define ADSWIO3_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition adswio3.h:406
#define ADSWIO3_DIAG_RESULT_SEL_1
Definition adswio3.h:183
#define ADSWIO3_GPIO_CONFIG_MODE_OUT
Definition adswio3.h:284
#define ADSWIO3_DIAG_RESULT_SEL_3
Definition adswio3.h:185
#define ADSWIO3_GPIO_CONFIG_SEL_D
Definition adswio3.h:276
#define ADSWIO3_GPIO_CONFIG_SEL_A
AD-SWIO 3 GPIO Configuration Register bit mask.
Definition adswio3.h:273
#define ADSWIO3_DIAG_RESULT_SEL_2
Definition adswio3.h:184
#define ADSWIO3_DIAG_RESULT_SEL_0
Definition adswio3.h:182
#define ADSWIO3_GPIO_CONFIG_GP_WK_PD_DIS
Definition adswio3.h:279
#define ADSWIO3_GPIO_CONFIG_GPO_DATA_HIGH
Definition adswio3.h:278
err_t adswio3_set_gpio_config(adswio3_t *ctx, uint8_t gpio_sel, uint8_t gpo_data, uint8_t gp_wk_pd_en, uint8_t out_mode)
AD-SWIO 3 GPIO configuration function.
err_t adswio3_get_diag_vtg(adswio3_t *ctx, uint8_t diag_sel, float *diag_vtg)
AD-SWIO 3 gets the diagnostic conversion results function.
void application_init(void)
Definition main.c:36
Application Task
This example demonstrates the use of the AD-SWIO 3 Click board. The demo application reads and displays the voltage level input, measured by the voltage between the I/OP and I/ON screw terminals and NTC thermistor temperature in degrees Celsius. Results are being sent to the UART Terminal, where you can track their changes.
{
float ntc_temp = 0, iop_ion_vtg = 0;
{
log_printf( &logger, " NTC Temperature: %.2f degC\r\n", ntc_temp );
Delay_ms ( 100 );
}
{
log_printf( &logger, "IOP/ION Voltage: %.3f V\r\n", iop_ion_vtg );
Delay_ms ( 100 );
}
log_printf( &logger, "_________________________\r\n" );
Delay_ms ( 1000 );
}
err_t adswio3_get_ntc_temp(adswio3_t *ctx, uint8_t diag_sel, float *ntc_temp)
AD-SWIO 3 gets the NTC temperature function.
void application_task(void)
Definition main.c:113
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.ADSWIO3
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 MikroElektronika compilers.