TOP Contributors

  1. MIKROE (2659 codes)
  2. Alcides Ramos (356 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 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 (137005 times)
  2. FAT32 Library (70125 times)
  3. Network Ethernet Library (56028 times)
  4. USB Device Library (46350 times)
  5. Network WiFi Library (41966 times)
  6. FT800 Library (41287 times)
  7. GSM click (29055 times)
  8. mikroSDK (26489 times)
  9. PID Library (26451 times)
  10. microSD click (25413 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

4-20mA T 2 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.5

mikroSDK Library: 2.0.0.0

Category: Current

Downloaded: 78 times

Not followed.

License: MIT license  

4-20mA T 2 Click is a compact add-on board for transmitting an analog output current over an industry-standard 4-20mA current loop. This board features DAC161S997, a low-power 16-bit ΣΔ digital-to-analog converter (DAC) from Texas Instruments. It has a programmable Power-Up condition and loop-error detection/reporting accessible via simple 4-wire SPI for data transfer and configuration of the DAC functions. In addition, it is characterized by low power consumption and the possibility of simple Highway Addressable Remote Transducer (HART) modulator interfacing, allowing the injection of FSK-modulated digital data into the 4-20mA current loop.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "4-20mA T 2 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "4-20mA T 2 click" changes.

Do you want to report abuse regarding "4-20mA T 2 click".

  • Information
  • Comments (0)

mikroSDK Library Blog


4-20mA T 2 click

4-20mA T 2 Click is a compact add-on board for transmitting an analog output current over an industry-standard 4-20mA current loop. This board features DAC161S997, a low-power 16-bit ΣΔ digital-to-analog converter (DAC) from Texas Instruments. It has a programmable Power-Up condition and loop-error detection/reporting accessible via simple 4-wire SPI for data transfer and configuration of the DAC functions. In addition, it is characterized by low power consumption and the possibility of simple Highway Addressable Remote Transducer (HART) modulator interfacing, allowing the injection of FSK-modulated digital data into the 4-20mA current loop.

420mat2_click.png

click Product page


Click library

  • Author : Nenad Filipovic
  • Date : Jan 2023.
  • Type : SPI type

Software Support

We provide a library for the 4-20mA T 2 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 4-20mA T 2 Click driver.

Standard key functions :

  • c420mat2_cfg_setup Config Object Initialization function.

    void c420mat2_cfg_setup ( c420mat2_cfg_t *cfg );
  • c420mat2_init Initialization function.

    err_t c420mat2_init ( c420mat2_t *ctx, c420mat2_cfg_t *cfg );
  • c420mat2_default_cfg Click Default Configuration function.

    err_t c420mat2_default_cfg ( c420mat2_t *ctx );

Example key functions :

  • c420mat2_set_output_current 4-20mA T 2 set output current function.

    err_t c420mat2_set_output_current ( c420mat2_t *ctx, float current_ma );
  • c420mat2_get_status 4-20mA T 2 set status function.

    err_t c420mat2_get_status ( c420mat2_t *ctx, c420mat2_status_t *status );
  • c420mat2_set_lower_limit 4-20mA T 2 set lower limit function.

    err_t  c420mat2_set_lower_limit ( c420mat2_t *ctx, float lower_limit_ma );

Example Description

This example demonstrates the use of 4-20mA T 2 Click board™. This driver provides functions to configure analog output current transfer over an industry standard 4-20mA current loop.

The demo application is composed of two sections :

Application Init

Initialization of SPI module and log UART. After driver initialization, default settings turn on the device.

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    c420mat2_cfg_t c420mat2_cfg;  /**< Click config object. */

    /** 
     * 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.
    c420mat2_cfg_setup( &c420mat2_cfg );
    C420MAT2_MAP_MIKROBUS( c420mat2_cfg, MIKROBUS_1 );
    if ( SPI_MASTER_ERROR == c420mat2_init( &c420mat2, &c420mat2_cfg ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( C420MAT2_ERROR == c420mat2_default_cfg ( &c420mat2 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
    log_printf( &logger, " -----------------------------\r\n" );
    Delay_ms ( 100 );
}

Application Task

This example demonstrates the use of the 4-20mA T 2 Click board™. This example periodically changes the analog output current transfer from 4mA to 20mA and display status every 5 seconds. Results are being sent to the UART Terminal, where you can track their changes.

void application_task ( void )
{
    if ( C420MAT2_OK == c420mat2_set_output_current( &c420mat2, 4.0 ) )
    {
        log_printf( &logger, " Loop Current:  4.0 mA \r\n" );
        log_printf( &logger, " - - - - - - - - - - - - - - -\r\n" );
        if ( C420MAT2_OK == c420mat2_get_status ( &c420mat2, &status ) )
        {
            display_status( );    
        }
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
    }

    if ( C420MAT2_OK == c420mat2_set_output_current( &c420mat2, 10.0 ) )
    {
        log_printf( &logger, " Loop Current: 10.0 mA \r\n" );
        log_printf( &logger, " - - - - - - - - - - - - - - -\r\n" );
        if ( C420MAT2_OK == c420mat2_get_status ( &c420mat2, &status ) )
        {
            display_status( );    
        }
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
    }

    if ( C420MAT2_OK == c420mat2_set_output_current( &c420mat2, 15.0 ) )
    {
        log_printf( &logger, " Loop Current: 15.0 mA \r\n" );
        log_printf( &logger, " - - - - - - - - - - - - - - -\r\n" );
        if ( C420MAT2_OK == c420mat2_get_status ( &c420mat2, &status ) )
        {
            display_status( );    
        }
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
    }

    if ( C420MAT2_OK == c420mat2_set_output_current( &c420mat2, 20.0 ) )
    {
        log_printf( &logger, " Loop Current: 20.0 mA \r\n" );
        log_printf( &logger, " - - - - - - - - - - - - - - -\r\n" );
        if ( C420MAT2_OK == c420mat2_get_status ( &c420mat2, &status ) )
        {
            display_status( );    
        }
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
    }
}

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.c420mAT2

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.


ALSO FROM THIS AUTHOR

MR Angle click

0

MR Angle Click is a compact add-on board that contains a magnetoresistive sensor with an integrated amplifier. This board features the KMZ60, a high precision sensor for magnetic angle measurement with single-ended cosine and sine outputs from NXP Semiconductors. The MR sensor element comes with two Wheatstone bridges for cosine and sine signals, supports functions for control circuit and signal amplification, and enables angular measurements with high accuracy by an excellent linearity and temperature drift behavior. The KMZ60 is fully automotive qualified as well as applicable for industrial and consumer applications. This Click board™ is suitable for rotor position detection for BLDC motors and Electronic Power Steering (EPS) applications, steering angle measurement, window wiper position detection, and general contactless angular measurement (e.g., throttle valves or actuators).

[Learn More]

Magneto 14 click

0

Magneto 14 Click is a compact add-on board with an accurate and reliable magnetic device. This board features the MA735, a contactless angle sensor with ABZ, and PWM output from Monolithic Power Systems. The MA735 sensor has a 9-bit to 13-bit resolution of the absolute angle encoder.

[Learn More]

Wirepas click

0

Wirepas Click is a compact add-on board that allows you to implement the Wirepas Mesh wireless connectivity stack to your application. This board features the WIRL-PRO2 Thetis-I (2.1.0.1121010), a radio module with Wirepas Mesh Protocol from Würth Elektronik. It supports creating a Wirepas routing mesh protocol and is optimized for ultra-low energy consumption. The large scalability is ideal for extensive IoT networks and can work as a host-controlled device.

[Learn More]