digiisolator2  2.1.0.0
Main Page

DIGI Isolator 2 click

PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU

[click Product page](CLICK_PRODUCT_PAGE_LINK)


Click library

  • Author : Stefan Filipovic
  • Date : Oct 2023.
  • Type : SPI type

Software Support

We provide a library for the DIGI Isolator 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 DIGI Isolator 2 Click driver.

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of DIGI Isolator 2 click board by reading and displaying the state of 8 digital input channels.

The demo application is composed of two sections :

Application Init

Initializes the driver and enables isolator outputs.

void application_init ( void )
{
log_cfg_t log_cfg;
digiisolator2_cfg_t digiisolator2_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
digiisolator2_cfg_setup( &digiisolator2_cfg );
DIGIISOLATOR2_MAP_MIKROBUS( digiisolator2_cfg, MIKROBUS_1 );
if ( DIGIISOLATOR2_OK != digiisolator2_init( &digiisolator2, &digiisolator2_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
digiisolator2_enable_output( &digiisolator2 );
log_info( &logger, " Application Task " );
}

Application Task

Reads the state of 8 digital input channels in hex format where MSB represents IN8 and LSB the channel IN1. The results are displayed on the USB UART every 500ms.

void application_task ( void )
{
uint8_t input_data = 0;
if ( DIGIISOLATOR2_OK == digiisolator2_read_inputs ( &digiisolator2, &input_data ) )
{
log_printf( &logger, " INPUT: 0x%.2X\r\n\n", ( uint16_t ) input_data );
Delay_ms ( 500 );
}
}

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

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.


digiisolator2_enable_output
void digiisolator2_enable_output(digiisolator2_t *ctx)
DIGI Isolator 2 enable output function.
application_task
void application_task(void)
Definition: main.c:61
DIGIISOLATOR2_MAP_MIKROBUS
#define DIGIISOLATOR2_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: digiisolator2.h:121
DIGIISOLATOR2_OK
@ DIGIISOLATOR2_OK
Definition: digiisolator2.h:207
digiisolator2_init
err_t digiisolator2_init(digiisolator2_t *ctx, digiisolator2_cfg_t *cfg)
DIGI Isolator 2 initialization function.
digiisolator2_read_inputs
err_t digiisolator2_read_inputs(digiisolator2_t *ctx, uint8_t *data_out)
DIGI Isolator 2 read inputs function.
digiisolator2_disable_output
void digiisolator2_disable_output(digiisolator2_t *ctx)
DIGI Isolator 2 disable output function.
digiisolator2_cfg_setup
void digiisolator2_cfg_setup(digiisolator2_cfg_t *cfg)
DIGI Isolator 2 configuration object setup function.
application_init
void application_init(void)
Definition: main.c:29
digiisolator2_t
DIGI Isolator 2 Click context object.
Definition: digiisolator2.h:150
digiisolator2_cfg_t
DIGI Isolator 2 Click configuration object.
Definition: digiisolator2.h:182