TOP Contributors

  1. MIKROE (2745 codes)
  2. Alcides Ramos (371 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 (138914 times)
  2. FAT32 Library (71500 times)
  3. Network Ethernet Library (56914 times)
  4. USB Device Library (47269 times)
  5. Network WiFi Library (42993 times)
  6. FT800 Library (42282 times)
  7. GSM click (29724 times)
  8. mikroSDK (27668 times)
  9. PID Library (26828 times)
  10. microSD click (26087 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 2 click

Rating:

5

Author: MIKROE

Last Updated: 2018-05-14

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Optocoupler

Downloaded: 4217 times

Not followed.

License: MIT license  

Opto 2 click is an optical isolator used to provide an optical galvanic isolation of sensitive lines.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "OPTO 2 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "OPTO 2 click" changes.

Do you want to report abuse regarding "OPTO 2 click".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

Opto 2 click

Opto 2 click

Native view of the Opto 2 click board.

View full image
Opto 2 click

Opto 2 click

Front and back view of the Opto 2 click board.

View full image

Library Description

The library performs the check procedure for the desired outputs (OUT1 - OUT4). For more details check the documentation.

Key functions:

  • uint8_t opto2_checkOut1( void ) - The function checks the state of the OUT1 pin.

Examples Description

The demo application is composed of three sections:

  • System Initialization - Initializes peripherals and pins.
  • Application Initialization -  Initializes GPIO driver and selects the outputs (OUT1 - OUT4) which state be checked.
  • Application Task - (code snippet) - Performs the check procedure for selected outputs and logs the states from the outputs on USB UART. Repeats the check procedure every 2 seconds.
     
void applicationTask()
{
 tmp = 1;

 for (cnt = 0; cnt < 4; cnt++)
 {
 switch (selOutput & tmp)
 {
 case 0x01 :
 {
 checkOutput = opto2_checkOut1();

 if (checkOutput == 0)
 {
 mikrobus_logWrite( "OUT1 is low", _LOG_LINE );
 }
 else
 {
 mikrobus_logWrite( "OUT1 is high", _LOG_LINE );
 }
 break;
 }
 case 0x02 :
 {
 checkOutput = opto2_checkOut2();

 if (checkOutput == 0)
 {
 mikrobus_logWrite( "OUT2 is low", _LOG_LINE );
 }
 else
 {
 mikrobus_logWrite( "OUT2 is high", _LOG_LINE );
 }
 break;
 }
 case 0x04 :
 {
 checkOutput = opto2_checkOut3();

 if (checkOutput == 0)
 {
 mikrobus_logWrite( "OUT3 is low", _LOG_LINE );
 }
 else
 {
 mikrobus_logWrite( "OUT3 is high", _LOG_LINE );
 }
 break;
 }
 case 0x08 :
 {
 checkOutput = opto2_checkOut4();

 if (checkOutput == 0)
 {
 mikrobus_logWrite( "OUT4 is low", _LOG_LINE );
 }
 else
 {
 mikrobus_logWrite( "OUT4 is high", _LOG_LINE );
 }
 break;
 }
 default :
 {
 break;
 }
 }

 tmp <<= 1;
 }
 mikrobus_logWrite( "", _LOG_LINE );

 Delay_ms( 2000 );
}
  • void opto2_setLogger( uint8_t selOut1, uint8_t selOut2, uint8_t selOut3, uint8_t selOut4 ) - Determines the outputs that be checked and logged on USB UART terminal. If selOutx is 1, the corresponding output will be included in check procedure.vAnd if selOutx is 0, that output will not be included in check procedure and will not be logged on UART.

mikroE Libraries used in the example:

  • UART

Additional notes and information

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

DAC 17 click

0

DAC 17 Click is a compact add-on board that establishes precise voltage output control in various electronic applications. This board features the DAC7558, a 12-bit, octal-channel voltage output digital-to-analog (DAC) from Texas Instruments. It offers flexible internal or external power options with a voltage range from 2.7V to 5.5V. It features a rapid settling time of 5µs, rail-to-rail output amplifiers, and the ability to simultaneously or sequentially update outputs, ensuring precise and efficient performance.

[Learn More]

Ambient 8 click

5

Ambient 8 click is equipped with the ambient light sensor (ALS) IC, providing measurements of the ambient light intensity in a digital format. It utilizes the LTR-329ALS-01, an ALS with the I2C interface.

[Learn More]

Thermo 3 click

5

Thermo 3 click carries TMP102, a digital temperature sensor IC with a tiny footprint of only 1.6mm x 1.6mm. The click is designed to run on a 3.3V power supply only. It communicates with the target MCU through mikroBUS I2C pins (SCL, SDA), and an additional Alert pint (INT on the default mikroBUS configuration).

[Learn More]