TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (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 (139248 times)
  2. FAT32 Library (71743 times)
  3. Network Ethernet Library (57115 times)
  4. USB Device Library (47428 times)
  5. Network WiFi Library (43082 times)
  6. FT800 Library (42403 times)
  7. GSM click (29835 times)
  8. mikroSDK (28073 times)
  9. PID Library (26885 times)
  10. microSD click (26198 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

Opto 7 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.8

mikroSDK Library: 2.0.0.0

Category: Optocoupler

Downloaded: 90 times

Not followed.

License: MIT license  

Opto 7 Click is a compact add-on board that provides uncomplicated safety isolation from high voltage. This board features two ISOM8710, high-speed single-channel opto-emulators from Texas Instruments. The ISOM8710 opto-emulator has a diode-emulator input and digital output

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Opto 7 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Opto 7 Click" changes.

Do you want to report abuse regarding "Opto 7 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Opto 7 Click

Opto 7 Click is a compact add-on board that provides uncomplicated safety isolation from high voltage. This board features two ISOM8710, high-speed single-channel opto-emulators from Texas Instruments. The ISOM8710 opto-emulator has a diode-emulator input and digital output

opto7_click.png

Click Product page


Click library

  • Author : Stefan Ilic
  • Date : Sep 2023.
  • Type : UART/GPIO type

Software Support

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

Standard key functions :

  • opto7_cfg_setup Config Object Initialization function.

    void opto7_cfg_setup ( opto7_cfg_t *cfg );
  • opto7_init Initialization function.

    err_t opto7_init ( opto7_t *ctx, opto7_cfg_t *cfg );

Example key functions :

  • opto7_generic_write Opto 7 data writing function.

    err_t opto7_generic_write ( opto7_t *ctx, uint8_t *data_in, uint16_t len );
  • opto7_set_gp1_pin Opto 7 set GP1 pin function.

    void opto7_set_gp1_pin( opto7_t *ctx, uint8_t pin_state );
  • opto7_get_gp2_pin Opto 7 get GP2 pin function.

    uint8_t opto7_get_gp2_pin( opto7_t *ctx );

Example Description

This example demonstrates the use of Opto 7 Click board by processing the incoming data and displaying them on the USB UART.

The demo application is composed of two sections :

Application Init

Initialization of UART LOG and GPIO pin, and UART drivers.


void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    opto7_cfg_t opto7_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.
    opto7_cfg_setup( &opto7_cfg );
    OPTO7_MAP_MIKROBUS( opto7_cfg, MIKROBUS_1 );

#if ( DEMO_EXAMPLE == EXAMPLE_GPIO )
    opto7_drv_interface_selection( &opto7_cfg, OPTO7_DRV_SEL_GPIO );
#else
    opto7_drv_interface_selection( &opto7_cfg, OPTO7_DRV_SEL_UART );
#endif

    if ( UART_ERROR == opto7_init( &opto7, &opto7_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

This example is made of two parts: GPIO Example - The output pin is toggled every 5 seconds and input pin state is being tracked. UART Example - Device assigned as transmitter is sending message and receiver is reading it and displaying it on USB UART.

void application_task ( void ) 
{
#if ( DEMO_EXAMPLE == EXAMPLE_GPIO )
    log_printf( &logger, " GP1 pin state HIGH \r\n" );
    opto7_set_gp1_pin( &opto7, OPTO7_PIN_STATE_HIGH );
     if ( OPTO7_PIN_STATE_HIGH == opto7_get_gp2_pin( &opto7 ) )
    {
        log_printf( &logger, " GP2 pin state HIGH \r\n" );
    }
    else
    {
        log_printf( &logger, " GP2 pin state LOW \r\n" );
    }
    log_printf( &logger, "- - - - - - - - - - - -\r\n" );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );

    log_printf( &logger, " GP1 pin state LOW \r\n" );
    opto7_set_gp1_pin( &opto7, OPTO7_PIN_STATE_LOW );
    if ( OPTO7_PIN_STATE_HIGH == opto7_get_gp2_pin( &opto7 ) )
    {
        log_printf( &logger, " GP2 pin state HIGH \r\n" );
    }
    else
    {
        log_printf( &logger, " GP2 pin state LOW \r\n" );
    }
    log_printf( &logger, "- - - - - - - - - - - -\r\n" );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
#else
#if defined TRANSMITTER
    log_printf( &logger, " Message sent! \r\n" );
    opto7_generic_write( &opto7, TX_MESSAGE, strlen( TX_MESSAGE ) );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
#else
    if ( OPTO7_OK == opto7_process( &opto7 ) ) 
    {
        opto7_log_app_buf( );
        opto7_clear_app_buf( );
    }
#endif

#endif
}

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

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

DC Motor 27 Click

0

DC Motor 27 Click is a compact add-on board that contains a high-performance brushed DC motor driver. This board features the DRV8143, an automotive half-bridge driver with integrated current sense and diagnostic from Texas Instruments.

[Learn More]

Oximeter 5 Click

0

Oximeter 5 Click is a compact add-on board suitable for measuring blood oxygen saturation. This board features the MAX30102, integrated pulse oximetry, and heart-rate monitor module from Analog Devices. The MAX30102 includes internal LEDs, photodetectors, optical elements, and low-noise electronics with ambient light rejection. It operates on a single 1.8V power supply acquired from both mikroBUS™ power rails for the internal LEDs, communicating through a standard I2C compatible interface. The MAX30102 can be shut down through software with zero standby current, allowing the power rails to remain powered at all times.

[Learn More]

Keylock 2 click

5

Keylock 2 Click carries antistatic process sealed keylock mechanism that has three positions. This board is intended to be used for implementation into applications which require mechanical lock mechanism, as well as for testing the same concepts in early development stage.

[Learn More]