How does it work?
DIGI IN 2 Click is based on the MAX22196, a high-performance octal industrial sink/source digital input IC from Analog Devices. This IC converts eight high-voltage (8V-24V) industrial inputs across channels 1 to 8 into standard logic-level outputs. It incorporates a serial interface for configuring and reading data in a serialized format via SPI. Each input channel can be individually set to operate as sinking (P-type) or sourcing (N-type), with built-in current limiters to reduce power wastage while adhering to the IEC 61131-2 standards. This Click board™ is ideal for various applications, including Programmable Logic Controllers (PLC), factory automation, and process control systems.
A distinctive feature of the MAX22196 is its ability to meet IEC 61131-2 Type 1/3 or Type 2 digital input requirements using a single resistor (R7) set at 12kΩ. The device offers flexibility by allowing the users to turn off current sinks or sources. Furthermore, each input channel has a customizable glitch/debounce filter and an optional 16-bit down-counter for enhanced input signal processing. The MAX22196 can draw power from a field supply ranging from 8V to 24V, including a green LED (VOK), to indicate the presence of a stable field supply.
An on-chip 5V linear regulator is another hallmark of the MAX22196, capable of delivering up to 20mA of load current to the VA header, which is left unpopulated. This on-chip regulator can be enabled via the FUNC SEL “R” jumper by placing its position from OFF to ON state. While it’s in the OFF position, the VA terminal presents a 5V linear regulator output, and the ON position presents a supply input powered by mikroBUS power rail™ (3.3V or 5V).
Regarding communication, the DIGI IN 2 Click interfaces with the host MCU through SPI to perform input data reading, diagnostic data acquisition, and register configuration at speeds up to 12MHz. The voltages at the 1-8 input terminals are compared against internal references to determine whether the field binary output sensor is ON (logic 1) or OFF (logic 0). All eight inputs are simultaneously latched by the assertion of either latch LTC or CS pins, and the data is made available in a serialized form through the SPI. Notably, the MAX22196 can address up to four devices on a shared SPI bus using ADDR SEL jumpers for direct access, and it supports daisy-chaining through the FUNC SEL “D” jumper.
The MAX22196 also features a fault indicator (FLT pin) for communicating various operational errors to the host MCU, including power supply undervoltage, overtemperature conditions, and CRC errors. The READY RDY signal confirms that the MAX22196 is powered on and operational. CRC error detection is enabled by default for enhanced data integrity, which is particularly beneficial in both addressable and daisy-chain SPI configurations. To visually present the status of its digital inputs, the board is equipped with a 3×3 yellow LED driver crossbar matrix. The ninth LED, positioned in the lower-left corner, mirrors the functionality of the VOK LED, providing a quick visual reference for the board’s operational status.
This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this 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
Port expander
Applications
Ideal for Programmable Logic Controllers (PLC), factory automation, and process control systems
On-board modules
MAX22196 – octal industrial sink/source digital input from Analog Devices
Key Features
Eight inputs individually configurable as sink or source, SPI serial interface, compliance with the IEC 61131-2 standard, programmable glitch/debounce filter, optional 16-bit down-counter on every channel, extensive diagnosis, addressable or daisy-chain SPI, low power dissipation, LED matrix indication, CRC error detection, on-chip regulator output, and more
Interface
SPI
Feature
ClickID
Compatibility
mikroBUS™
Click board size
L (57.15 x 25.4 mm)
Input Voltage
3.3V or 5V,External
Pinout diagram
This table shows how the pinout on DIGI IN 2 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 |
LD2 | VOK | – | Valid External Power Supply LED Indicator |
LD3-LD11 | – | – | DIGI IN Stated LED Indicators |
JP1 | VCC SEL | – | Logic Voltage Level Selection 3V3/5V: Left position 3V3, Right position 5V |
JP2 | FUNC SEL – R | – | On-Chip Regulator Enable OFF/ON: Left position OFF, Right position ON |
JP3-JP4 | ADDR SEL | – | SPI Address Selection 0/1: Left position 0, Right position 1 |
JP5 | FUNC SEL – C | – | CRC Error Detection Enable OFF/ON: Left position OFF, Right position ON |
JP6 | FUNC SEL – D | – | Daisy-Chain SPI Mode Enable OFF/ON: Left position OFF, Right position ON |
DIGI IN 2 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
External Supply Voltage | 8 | – | 24 | V |
Input Channels Voltage | 8 | – | 24 | V |
VA On-Chip Regulator Output Current | – | – | 20 | mA |
Software Support
We provide a library for the DIGI IN 2 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 DIGI IN 2 Click driver.
Key functions
-
digiin2_get_flt_pin
This function is used to get state of the FLT pin. -
digiin2_write_reg
This function is used to write data into the selected register by using SPI serial interface. -
digiin2_read_reg
This function reads a data byte from the selected register by using SPI serial interface.
Example Description
This example demonstrates the use of DIGI IN 2 Click board by reading and displaying the state of the channels.
void application_task ( void )
{
uint8_t channel_data = 0;
digiin2_pulse_latch( &digiin2 );
if ( DIGIIN2_OK == digiin2_read_reg( &digiin2, DIGIIN2_REG_DISTATE, &channel_data ) )
{
if ( channel_data & DIGIIN2_CHANNEL_1_MASK )
{
log_printf( &logger, "Channel 1 counter: HIGH rn" );
}
else
{
log_printf( &logger, "Channel 1 counter: LOW rn" );
}
if ( channel_data & DIGIIN2_CHANNEL_2_MASK )
{
log_printf( &logger, "Channel 2 counter: HIGH rn" );
}
else
{
log_printf( &logger, "Channel 2 counter: LOW rn" );
}
if ( channel_data & DIGIIN2_CHANNEL_3_MASK )
{
log_printf( &logger, "Channel 3 counter: HIGH rn" );
}
else
{
log_printf( &logger, "Channel 3 counter: LOW rn" );
}
if ( channel_data & DIGIIN2_CHANNEL_4_MASK )
{
log_printf( &logger, "Channel 4 counter: HIGH rn" );
}
else
{
log_printf( &logger, "Channel 4 counter: LOW rn" );
}
if ( channel_data & DIGIIN2_CHANNEL_5_MASK )
{
log_printf( &logger, "Channel 5 counter: HIGH rn" );
}
else
{
log_printf( &logger, "Channel 5 counter: LOW rn" );
}
if ( channel_data & DIGIIN2_CHANNEL_6_MASK )
{
log_printf( &logger, "Channel 6 counter: HIGH rn" );
}
else
{
log_printf( &logger, "Channel 6 counter: LOW rn" );
}
if ( channel_data & DIGIIN2_CHANNEL_7_MASK )
{
log_printf( &logger, "Channel 7 counter: HIGH rn" );
}
else
{
log_printf( &logger, "Channel 7 counter: LOW rn" );
}
if ( channel_data & DIGIIN2_CHANNEL_8_MASK )
{
log_printf( &logger, "Channel 8 counter: HIGH rn" );
}
else
{
log_printf( &logger, "Channel 8 counter: LOW rn" );
}
log_printf( &logger, "- - - - - - - - - - - - - -rn" );
}
else
{
log_error( &logger, " Read error." );
}
if ( DIGIIN2_PIN_STATE_HIGH == digiin2_get_flt_pin( &digiin2 ) )
{
uint8_t flt_data = 0;
digiin2_read_reg( &digiin2, DIGIIN2_REG_FAULT, &flt_data );
log_printf( &logger, "Fault1 data: 0x%.2X rn", ( uint16_t ) flt_data );
digiin2_read_reg( &digiin2, DIGIIN2_REG_FAULT2, &flt_data );
log_printf( &logger, "Fault2 data: 0x%.2X rn", ( uint16_t ) flt_data );
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.DIGIIN2
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.