TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (387 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (120 codes)
  5. Bugz Bensce (97 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (140167 times)
  2. FAT32 Library (72621 times)
  3. Network Ethernet Library (57641 times)
  4. USB Device Library (47954 times)
  5. Network WiFi Library (43553 times)
  6. FT800 Library (42942 times)
  7. GSM click (30140 times)
  8. mikroSDK (28669 times)
  9. PID Library (27055 times)
  10. microSD click (26552 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

AD SWIO 2 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.12

mikroSDK Library: 2.0.0.0

Category: ADC-DAC

Downloaded: 224 times

Not followed.

License: MIT license  

AD-SWIO 2 Click is a quad-channel software configurable input/output solution based on AD74413R, for building and process control application. The AD74413R is a quad-channel software configurable input/output solution for building and process control applications. The device provides a fully integrated single chip solution for input and output operation. The AD-SWIO 2 Click contains four 13-bit DACs, one per chanal, and 16-bit Σ-∆ ADC.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "AD SWIO 2 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "AD SWIO 2 Click" changes.

Do you want to report abuse regarding "AD SWIO 2 Click".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


AD SWIO 2 Click

AD-SWIO 2 Click is a quad-channel software configurable input/output solution based on AD74413R, for building and process control application. The AD74413R is a quad-channel software configurable input/output solution for building and process control applications. The device provides a fully integrated single chip solution for input and output operation. The AD-SWIO 2 Click contains four 13-bit DACs, one per chanal, and 16-bit Σ-∆ ADC.

adswio2_click.png

Click Product page


Click library

  • Author : MikroE Team
  • Date : jun 2020.
  • Type : SPI type

Software Support

We provide a library for the AdSwio2 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for AdSwio2 Click driver.

Standard key functions :

  • adswio2_cfg_setup Config Object Initialization function.

    void adswio2_cfg_setup ( adswio2_cfg_t *cfg ); 
  • adswio2_init Initialization function.

    ADSWIO2_RETVAL adswio2_init ( adswio2_t *ctx, adswio2_cfg_t *cfg );
  • adswio2_default_cfg Click Default Configuration function.

    void adswio2_default_cfg ( adswio2_t *ctx );

Example key functions :

  • adswio2_get_conv_results This function allows user to get the converted results of the selected channel.

    adswio2_err_t adswio2_get_conv_results ( adswio2_t *ctx, uint8_t channel, uint16_t *data_out );
  • adswio2_status_pin_ready This function checks the status of the ready pin.

    uint8_t adswio2_status_pin_ready ( adswio2_t *ctx );

Examples Description

This Click is a quad-channel software configurable input/output solution for building and process control application. The AD-SWIO 2 Click contains four 13-bit DACs, one per chanal, and 16-bit Σ-∆ ADC. These options give a lot of flexibility in choosing functionality for analog output, analog input, digital input, resistance temperature detector (RTD), and thermocouple measurements integrated into a single chip solution with a serial peripheral interface (SPI).

The demo application is composed of two sections :

Application Init

Performs a hardware reset of the Click board and executes a default configuration that enables channel A and sets it to measure voltage input in the range from 0V to 10V, with 4800 SPS.


void application_init ( void )
{
    log_cfg_t log_cfg;
    adswio2_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.

    adswio2_cfg_setup( &cfg );
    ADSWIO2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    adswio2_init( &adswio2, &cfg );
    Delay_ms ( 100 );

    adswio2_default_cfg( &adswio2 );
    Delay_ms ( 1000 );

    adswio2_rdy  = DUMMY;
    adswio2_ch_a = DUMMY;
    adswio2_res  = DUMMY;
    adswio2_err  = ADSWIO2_ERR_STATUS_OK;
    log_printf( &logger, " AD-SWIO 2 Click initialization done \r\n");
    log_printf( &logger, "************************************\r\n");
}

Application Task

Waits for the data ready and then reads the results of ADC conversion from channel A and if response is ok, then prints the results on the uart console.


void application_task ( void )
{
    timeout = 0;
    do
    {
        Delay_1ms( );
        timeout++;
        adswio2_rdy = adswio2_status_pin_ready( &adswio2 );
        if ( timeout > 3000 ) 
        {
            timeout = 0;
            log_printf( &logger, " Reinitializing...");
            adswio2_default_cfg( &adswio2 );
            log_printf( &logger, "Done\r\n");
        }
    }
    while ( adswio2_rdy != 0 );

    adswio2_err = adswio2_get_conv_results( &adswio2, ADSWIO2_SETUP_CONV_EN_CHA, &adswio2_ch_a );

    if ( adswio2_err == ADSWIO2_ERR_STATUS_OK )
    {
        adswio2_res = adswio2_ch_a;
        adswio2_res /= ADSWIO2_RANGE_RESOLUTION;
        adswio2_res *= ADSWIO2_RANGE_VOLT_MV;
        adswio2_ch_a = adswio2_res;

        log_printf( &logger, " Voltage from channel A: %d mV\r\n", adswio2_ch_a );

        log_printf( &logger, "-----------------------------------\r\n\r\n" );
        Delay_ms ( 200 );
    }
}

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.AdSwio2

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. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.


ALSO FROM THIS AUTHOR

4G LTE GNSS Click

0

4G LTE&GNSS Click is a compact add-on board designed for advanced global tracking and telematics applications, enabling developers to build highly efficient and smaller solutions without compromising performance. This board features the LENA-R8, a multi-mode LTE Cat 1bis module from u-blox. It stands out for its compact size and extensive network compatibility. It supports 14 LTE bands, four GSM/GPRS bands for universal connectivity, and integrated u-blox GNSS for precise global tracking. The board facilitates seamless communication via UART and includes a USB interface for comprehensive device management and firmware updates.

[Learn More]

Relay click

0

Relay click is a dual relay Click board, which can be operated by the host MCU. This Click board offers an elegant and easy solution for controlling a wide range of high power applications.

[Learn More]

Skywire click

0

Skywire click is an adapter click, which hosts NimbeLink/Skywire cellular modules (using stacking headers) to MikroElektronika development boards. It carries MCP1826 Low drop out regulator from Microchip. Skywire click is designed to run either on 3.3V or 5V power supply. The click communicates with the target MCU over UART interface.

[Learn More]