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 (136989 times)
  2. FAT32 Library (70100 times)
  3. Network Ethernet Library (56023 times)
  4. USB Device Library (46345 times)
  5. Network WiFi Library (41961 times)
  6. FT800 Library (41274 times)
  7. GSM click (29051 times)
  8. mikroSDK (26489 times)
  9. PID Library (26447 times)
  10. microSD click (25412 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

I2C 1-Wire click

Rating:

5

Author: MIKROE

Last Updated: 2019-05-29

Package Version: 1.0.0.1

mikroSDK Library: 1.0.0.0

Category: 1-Wire

Downloaded: 5433 times

Followed by: 2 users

License: MIT license  

This example shows ID numbers from Unique ID Click and several Thermo Sensors (DS1820), connected on each channel. If there is no device detected on the channel, warning note is shown on TFT.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "I2C 1-Wire click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "I2C 1-Wire click" changes.

Do you want to report abuse regarding "I2C 1-Wire 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

I2C 1-Wire click

I2C 1-Wire click

Front and back view of I2C 1-Wire Click Board designed in mikroBUS form factor.

View full image

Library Description

The library covers all the necessary functions to control I2C OneWire click board. 
Library performs the communication with the device via I2C protocol by writing to registers and by reading from registers.

Key functions:

  • uint8_t i2conewire_setChannel( uint8_t channel ) - Set the channel function.
  • void i2conewire_writeByteOneWire( uint8_t writeData ) - Generic One Wire writes the byte of data function.
  • uint8_t i2conewire_readByteOneWire() - Generic One Wire read the byte of data function.

Examples description

The application is composed of the three sections :

  • System Initialization - Initializes I2C structures and start to write log.
  • Application Initialization - Initialization driver enables - I2C, also write log.
  • Application Task - This is an example which demonstrates the use of I2C OneWire click board. I2C OneWire click communicates with register via I2C protocol by the write to register and read from the register. This example shows ID numbers for any click with OneWire protocol connected on each channel. Results are being sent to the Usart Terminal where you can track their changes. All data logs write on USB uart changes for every 1 sec.
void applicationTask()
{
    stateOfCh = 1;
    i2conewire_softReset();
    Delay_10ms();

    i2conewire_setConfig( _I2CONEWIRE_CONFIG_1WS_HIGH | _I2CONEWIRE_CONFIG_SPU_HIGH | _I2CONEWIRE_CONFIG_APU_LOW );
    Delay_10ms();

    for( cntCh = 0; cntCh < 8; cntCh++ )
    {
        i2conewire_setChannel( cntCh );
        i2conewire_oneWireReset();
        Delay_10ms();

        i2conewire_writeByteOneWire( _I2CONEWIRE_WIRE_COMMAND_READ_ROM );
        Delay_10ms();

        for ( cntVal = 8; cntVal > 0; cntVal-- )
        {
            idCode[ cntVal ] = i2conewire_readByteOneWire();

            if( idCode[ cntVal ] == _I2CONEWIRE_WIRE_RESULT_OK )
            {
                ByteToStr( cntCh, logText );
                ltrim( logText );
                mikrobus_logWrite( " Channel ", _LOG_TEXT );
                mikrobus_logWrite( logText, _LOG_TEXT );
                mikrobus_logWrite( " : No device on the channel! ", _LOG_TEXT );
                Delay_100ms();
                break;
            }
            else if ( stateOfCh )
            {
                ByteToStr( cntCh, logText );
                ltrim( logText );
                mikrobus_logWrite( " Channel ", _LOG_TEXT );
                mikrobus_logWrite( logText, _LOG_TEXT );
                mikrobus_logWrite( " : ID = 0x", _LOG_TEXT );
                stateOfCh = 0;
            }

            ByteToHex( idCode[ cntVal ], logText );
            ltrim( logText );
            mikrobus_logWrite( logText, _LOG_TEXT );
            Delay_100ms();
        }

        mikrobus_logWrite( " ", _LOG_LINE );
        mikrobus_logWrite( "---------------------------------------", _LOG_LINE );
   }
}

Other mikroE Libraries used in the example:

  • I2C
  • UART
  • Conversions

Additional notes and informations

Depending on the development board you are using, you may need USB UART clickUSB 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

Load Cell 6 click

0

Load Cell 6 Click is a compact add-on board representing a weigh scale solution. This board features the MAX11270, a high-performance 24-bit delta-sigma ADC that achieves excellent 130dB SNR while dissipating an ultra-low 10mW from Maxim Integrated, now part of Analog Devices. This SPI-configurable ADC sample rates up to 64ksps allow precision DC and AC measurements, with integral non-linearity guaranteed to 4ppm maximum. The MAX11270 offers a 6.5nV/√Hz noise programmable gain amplifier with gain settings between 1x to 128x. Optional buffers are also included to isolate the signal inputs from the switched capacitor sampling network, which allows the MAX11270 to be used with high-impedance sources without compromising the available dynamic range.

[Learn More]

Gesture Board

1

The Gesture board, carrying Microchip’s MGSC3130 3D gesture recognition controller, brings a new approach to designing intuitive user interfaces. It’s like a touchpad whose input area extends 15cm upwards into space.

[Learn More]

Mikromedia 5 for Tiva - RF Communication Example

5

This is demonstration project how Mikromedia 5 for Tiva communicates over RF. Data is send over simple 'led protocol' (1 byte command). Development board for Stellaris with an add-on board nRF Click is used as a receiver device.

[Learn More]