; // Initiate Repeated Start condition on SDA and SCL pins. It is provided as example code; if you want a real program use i2cget from the i2c-tools package. Ultrasonic Ranger The drawback of SPI is the number of pins required.SPI bus requires four lines in connecting a single master to a single slave. This code example requires the use of the MPLABX IDE’s debugging feature. In order to use PIC18F4550 I2C in slave mode, we must configure SDA and SCL pins as inputs ( RC3 and RC4). Read about 'I2c peripheral library for PIC24 and example code for I2C for PIC24' on element14.com. Basic Arduino example code for I2C LCD. You also have the option to opt-out of these cookies. display module to show the results. TPA81 Thermal I have been trying to make a slave I2C device communicate with my STM32F0 board, with no success. Hello, I am working on PIC24 and Would like to have the I@C example code for PIC24 and I2C peripheral library for PIC24. This example uses the SRF05 in one pin mode, where the Trigger and Only a Master can start a data transfer and Slaves respond to the Master. Here is the example I2C … After that acknowledge bit will be received from a slave device, based on the status of acknowledge. It runs the motors back and forth News. The first seven bits of the control byte make up the slave address. Motor Driver This is an interrupt service routine used to read data/address from I2C bus on interrupt. Whilst it has either been complied for the PIC24FJ64GB004 or the project is setup for the PIC24FJ64GB004 it is easy enough to change it for another PIC24 series device. Some microchip MCUs also have more than one I2C module in a single chip. To use MikroC Pro for I2C communication, we just need to understand the working of each function associated with this library. The Microchip I2C drivers and their APIs that ship with the MPLAB compiler are almost impossible to debug or understand. This register used to hold that we transmit or receive with I2C protocol. All the modules which use the I2C … We must configure these registers. In Proteus, we need to connect I2C Debugger. File List Here is a list of all documented files with brief descriptions: Just picked some examples for I2C communication and found the most common example ‘how to communicate with IC2 eeprom’ and decided to simulate this with my PICs. Every I²C device must have a built-in 7 bits address. During this state the transmitter should release the SDA bus to allow the receiver to derive it. SRF01 Basically I initialise the I2C module and turn on an LED, then I enter a loop, open the I2C connection using address 0x22 and wait for the master to send some data. I2C_Write() used to transmit address and data through the SDA wire. We should call this function inside the main function before using other routines. From readme.txt: I have included this code as an Example of using a 20x2 character LCD, I2C EEPROM and basic I/O Control, it also has a ascii to unsigned long function that I created to convert entered text into a useable number.The HSPG project is a specialized piece of hardware for accurately generating pulses on a rather large piece of equipment (it takes up a large room). Then it is read sequentially and output (write) through PORTB. Microcontrollerslab.com All Rights Reserved. SD20 Servo We used it to send or receive data in/out from SDA wire. Speed calculations equations are provided for each peripheral. F) (ZIP217KB ) 164views,05 Jun 2017 I thought I was golden until I looked at the code examples for I2C. This I2C_Read_Byte() routine reads a byte from the I2C_Bus and returns its value. To select master mode, we need to set/clear some bots of SSPCON1 such as SSPM and SSPEN. It was written for use with a 16F877 PIC, LabX-1 development board, and a 24LC64 EEPROM. Note: These examples use peripheral library binaries distributed with MPLAB XC32. The I2C protocol is used in a huge range of chips - just a few examples from this site include the DS1307 (RTC), SSD1306 (OLED Display), MCP23017 (Serial expander). LCD03. After creating the device strcuture, user need to fill in the various parameters as shown below. MD03 24V 20A The main difference should be that some of the operations are of no use (for example : enforcing the state of pins is not required, as in I2C mode only the TRIS needs to be changed). We can only use it to configure in slave mode. Provide interrupt after receiving general address call from SSPSR. SPI only allows one master on the bus, but it does support an arbitrary number of slaves. Now, it will behave as slave-receiver or slave-transmitter depending upon the value of the R/W bit. If it should be installed separately can you please assist. At the start, we will see the introduction of I2C communication. 01 — 06 April 2005 Application note Document information Info Content ... rate/speed of the peripheral accordingly before running the example code. For this tutorial, I used this 16×2 I2C character LCD display, but you can use other I2C LCDs of different sizes as well. Copyright © 2013-2021 It reads the bearing data from the I2C Debugger can be found where CRO can be found in Proteus. Hi-Tech C I2C Master Example Code. This register has two different functions in slave or master mode. It is a short distance serial interface that requires only two bus lines for bi-directional data transfer. Secondly, we will understand the control and configuration registers of PIC Microcontroller I2C module. This uses the I2C bus to connect the PIC24FJ16GA002 to the These are seven functions used for various purposes such as module, initialization, transmit data, receive data, start and stop data transmission. It defines the clock frequency. Here is some example code for a Microchip 12F1822 microcontroller which is setup as an I2C Master to communicate with one of our Servo*Pro chips (which is an I2C slave). Note the SRF05's mode pin is Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. The SD21 is a ready wired module which can save a lot of time This category only includes cookies that ensures basic functionalities and security features of the website. When data is received I check it's value, if it's 9 I turn on another LED. It’s going to be a very long read, so stick around and let’s get started! If the slave is not in a position to receive or transmit another complete byte of data it can hold the SCL line low to force the master into a wait state. Each salve will have a unique address. Because a single master device can send data to multiple slaves. This example runs the motor at varying speeds, displaying the The SCL clock line is always driven by the master. PIC 16F877 (MSSP) I2C Introduction . How to click into mcc tutorial #2 how to setup i2c-based. Data is sent either direction on the serial data line (SDA) by the master or slave. This is a prototype that returns a short type variable. sanjib (Community Member) Edited by STM Community July 21, 2018 at 5:44 PM. SRF04 their maximum range. This example drives both motors and used the turn register to 5A Motor Driver This is a simple program to read a byte from an i2c client under Linux. To use MPLAB XC8 compiler, we must understand control and status registers of I2C communication module. But we can use same library for each I2C module. *****/ // unsigned int StartI2C(void) { /* * This function generates an I2C start condition and returns status of the Start. I is a Bidirectional protocol I2C is a Bi-directional protocol. The TPA81 connects to the PIC24FJ16GA002 using the I2C bus. The PPS constitutes pins which users can map to the input and/or output of some digital peripherals. By using a clock signal, it achieves high-speed data transfer rate. 9th March 2016. The remainder of this document provides a brief overview of each example Peripheral Library Examples. SRF05 The light reading is only available on the This is basically a buffer register to which we write and read data bytes. I2C example code. In slave mode, it offers these settings: Firstly, SSPSTAT (SMP_bit) register control Slew Rate (High-speed mode or standard speed mode). People seem to be having major issues with the PIC24F series. For some unfathomable reason, they have distributed the I2C access code in 10 (or more) different files with 5 lines of code each. I²C stands for Inter-Integrated Circuit. Examples mplab xpress. The first address word contains conventional code as “11110” on MSBsto aware the slaves on the bus of 10-bits device address. It will set the SSPIF interrupt bit. This module enables the user to write the code in python for communicating with the I2C device. Communicates over I2C with the port expander to turn the LED on and off at regular intervals. In the end, I2C programming examples will be discussed in both compilers. Thanks. Sometimes we need more external EEPROM to store data permanently that we can use even after microcontroller turn off or resets. Expand Post. After the start condition, we need to specify the slave address. Download (4KB). If you're familiar with the I2C protocol, you'll know a typical master write sequence looks like this: Load the slave address into  SSPADD register, Set slew rate as default rate (low-speed operation ) using SSPSTAT register SMP bit, Enable I2C slave mode option with SSPCON1 register SSPM3: SSPM0 bits ( four options possible for slave mode), Enable global, peripherals and I2C module interrupts. It selects SMBus S. We can configure it in Master or Slave mode like this: In Master mode, this bit is reserved. The next section discussing using the example code, while the example directory lists all available examples. If this address matches with the address of your device, a microcontroller (acting as a slave ) will generate an interrupt. Initially, the Read/~Write bit will be zero. For example, we can use if condition to evaluate output like this: Microcontrollers are known as standalone chips as they have internal memory and processor embedded. file. Posted on May 28, 2014 at 14:40 . To access the latest code examples, follow the path File -> Example Projects in PSoC Creator.To build with a different version of PSoC Creator, first update the project components in Creator by following the path Project -> Update Components. use the PIC24F family, in this case a PIC24FJ16GA002 to Bruce to be published by Cengage Learning in December 2008.. For some unfathomable reason, they have distributed the I2C access code in 10 (or more) different files with 5 lines of code each. Download the SRF08_pic24f.zip  on the first line of the LCD and 'LCD tutorial' on the second line. Data transfer continues when the slave is ready for another byte of data and releases the clock line. In this I2C tutorial you will learn all about the 2 wire I2C serial protocol; How easy it is to use, how it works and when to use it.. Pic24f i2c sample code Sample code for sht21. Views: 25643. Along with this, each additional slave requires one additional chip select pin on the master. This code uses the MSSP port built into the microcontroller not bit-banged I2C. To overcome this problem, devices often have multiple built-in addresses that we can select through external configuration pins on the device. SSPCON1: MSSP Control Register 1 … compared to the SD20 above. Settings for stop, start and repeated start bits. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. Most of the PIC24F family devices support the Peripheral Pin Select (PPS) feature. I have lots of examples on using the I2C bus on the website, but many of these are using high level controllers and do not show the detail of what is actually happening on the bus. example displays the ambient temperature and 8 temperatures from temperature,  motor current and speed on the LCD03. In master transmitter mode, PIC microcontroller sends serial data through the SDA line and outputs clock through the SCL line. A typecast is to force a type of value to be of a specific type. The code in this sample does several things: Initializes the I2C bus and the port expander. Download the SRF05_pic24f.zip  and the basic ranging commands are the same. ^ Go to top. Download the file I2C.zip into your I2C work directory and unzip it. But opting out of some of these cookies may affect your browsing experience. Both SCL and SDA lines are open-drain drivers and are connected to a positive supply voltage through pull-up resistors. Here is the example I2C … Example code from the textbook This page gives example PIC24 code accompanying the textbook titled "Microcontrollers: From Assembly to C with the PIC24 Family" by R. Reese, B. Jones and J.W. After the Start condition, the bus is considered busy and can be used by another master only after a Stop condition is detected. For example, instead of OpenI2C(), they have OpenI2C1() and openI2C2(). CMPS03. I am slowly copying all of the source code to GitHub, so anyone can submit pull requests to improve the code.Tonight, I shifted RS232 serial port examples and the USB example for the PIC18F4550. If a device is found, it will display the address in the serial monitor. MikroC Pro for PIC provides a built-in library that we can easily use to transfer data to I2C-Slave devices. Controller Based on the ACKSTAT bit, I2C Module generates interrupt on the 9th clock cycle. If I receive positive feedback, more tutorials will follow. Now we will interface that I2C device with Pic microcontroller PIC16F877A. This example drives the RD02 motors and displays the encoder # include < I2C.h > /* MMA8452Q Basic Example Code: Nathan Seidle: SparkFun Electronics: November 5, 2012: License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license). Once the application code is flashed on to the device, open the serial terminal application and configure the baudrate to 9600 , No parity , 8 Data bits and 1 Stop bit and no flow control. This example code shows how to read the X/Y/Z accelerations and basic functions of the MMA5842. Can anyone give me an example code to config, init and send and receive data through the I2C bus. Learn the basics of I2C communication with PIC microcontroller. also reads the bearing as a byte. Therefore, if we use MikroC Pro, we do not need to care much about the I2C module internal configuration register of Pic microcontrollers. I2C; SPI 3-wire is currently not supported in the API. Ultrasonic Ranger We also use third-party cookies that help us analyze and understand how you use this website. output pin when sending data back. All data transfers must be preceded by a Start condition. 10th March 2016. An_255_usb to i2c example using the ft232h and ft201x devices. It checks either I2C_Bus is free or busy. For my test the Master PIC will send 16 bytes of data to Slave PIC that will store in memory for later request. Devices with higher bit address might not be seen properly. Hi-Tech C I2C Master Example Code. If the address gets matched, the device considers itself addressed by the master. It checks either I2C bus is busy or free. You can copy the code by clicking on the button in the top right corner of the code field. The following is some example code from the text: Programming 16-Bit PIC Microcontrollers in C, Second Edition: Learning to Fly the PIC 24 You may want to consider purchasing a copy, it covers the PIC24 and Explorer 16 Dev Board quite well. resistors for the whole I2C bus regardless of however many I2C I2C tutorial; Using the I2C Bus . Each slave connected to the bus is software addressable by a unique 7-bit or 10-bit. The byte put on the SDA line must be 8-bits long. It’s designed to run on Microchips PIC24FJ64GB004 PIC microcontrollers. In this section, we will see how to program I2C module of PIC184550 microcontroller using MPLAB XC8 compiler. In fact, the code you use should (in theory) works perfectly using the same PIN, configured in I2C mode. I2C1_Init(100000); In this example code,  we will examine how to write and read data from the I2C device and show the output on some LCD or LEDs. I²C module is initialized on the RC3 (SCL) and RC4 (SDA) pins of PIC16F877A microcontroller by I2C1_Init(100000). It is used for the initialization with the required clock frequency. Expand Post. First, enable master mode by setting/clearing appropriate bits SSPCON1 register of PIC18F4550, After that, we need to set start-enable bit SEN (SSPCON2<0>), Load value of salve address to SSPBUF register, Sends one byte which contains address and R/~W bit value to the SDA line, After that receive ACK bit from the slave device and store its value in SSPCON2 register (ACKSTAT bit). SRF08. These are the top rated real world C# (CSharp) examples of Windows.Devices.I2c.I2cDevice extracted from open source projects. We will use the I2C library in MikroC for Pic MCU. Start and stop bits show the start and end of the serial data transfer. It reads the bearing as a 16 bit integer and For debugging purposed there are I2C … Example Hi-Tech C code for I2C, interfacing to Microchip 24LC01B non-volatile EEPROM and Dallas Temperature sensors DS1775 and DS1721. I²C protocol uses 2 signal lines, a serial data line (SDA) and a serial clock line (SCL). At the start, we will see the introduction of I2C communication. PCF8574(0x38); uint8_t is a type so that is why the compiler expect a typecast at this position, see my 1. example - (uint8_t). module. Actually you don't need this so example 2. without the typecast is enough. The code examples linked in the table below are compatible with PSoC Creator 3.0 SP2. There are popular compilers used for pic microcontrollers programming such as MPLAB XC8 and MikroC Pro for PIC. You can upload the following example code to the Arduino using the Arduino IDE. A breakpoint has been added in the main while loop that will halt code execution after the Master has completed the transfer and reception of data. This example shows how to drive servos by using the SD20 chip. SSCCON1 configuration register performs various control functions such as: SSPCON2 register has different settings for slave and master mode. In this I2C tutorial you will learn all about the 2 wire I2C serial protocol; How easy it is to use, how it works and when to use it.. For example, instead of OpenI2C(), they have OpenI2C1() and openI2C2(). For I2C bus, the clock speed can be chosen between. Follow these steps: I2C_Slave_Initialization function configures SSPSTAT, SSPCON1, SSPCON2 and INTCON registers used for pic microcontroller slave mode configuration. These are the six registers used for two-wire communications. FIGURE 1: I2C MASTER MODE BLOCK DIAGRAM Author: Richard L. Fischer Microchip Technology Inc. Read Write SSPSR START bit, STOP bit, SSPBUF Internal Data Bus Set/Reset, S, P, WCOL (SSPSTAT) Shift Clock MSb LSb SDA … Hi-tech c i2c master example code. In order to use the desired I²C library routine, we simply change the number 1 in the prototype with the appropriate module number, i.e. On the Arduino website, you can find a simple example sketch that scans the I2C-bus for devices. I2C bus have 1k8 pull-up resistors to 5v. This website uses cookies to improve your experience while you navigate through the website. I2C I2C -- OverviewOverview l I2C is a Bidirectional protocol l Data is sent either direction on the serial data line (SDA) by the master or slave. This is the demo software which runs on PIC24F LCD Curiosity Development Board (DM240017). SDA: RC4 (Master) to 5 (Slave) SCL: RC3 (Master) to 6 (Slave) To display the output: LEDs are connected to PORT B. I2C Code Example MikroC Pro. It is possible to have multiple Masters on a common bus, but only one could be active at a time. Because data transfer occurs from master to the slave upon address match. Firstly, we will see examples with MikroC pro and after that, we look at some examples with MPLAB XC8 Compiler. microchip sample code .....\8bitCode Examples .....\.....\a2d.zip .....\.....\bttn.zip MAAP module can be used either in SPI or I2C modes or both also. These cookies do not store any personal information. This directory may contain more than one code example. And finally, do a couple of LAB projects to put it all together and get it to work practically. The SRF01 uses a single wire for both serial input and output. In it you'll find USI I2C (for ATtiny2313) and TWI I2C (for ATmega168). So I’ve managed to put together a simple (and what I consider to be intuitive) driver. between 2 values output by the encoders. The I2C protocol is used in a huge range of chips - just a few examples from this site include the DS1307 (RTC), SSD1306 (OLED Display), MCP23017 (Serial expander). But SPI is faster, easy to configure, easy to convert, allow frame sync etc. This example code is designed to run on our picoTRONICS24 PIC Development Board. Interrupt is generated once the Stop condition is complete. pic16f15244-family-advanced-i2c-io-expander This code example implements an advanced 8-bit I2C I/O expander using the general purpose PIC16F15244 family … about the I2C bus in our I2C SRF08 When this module is configured as a master, it is used to define a data transfer rate or generate a baud rate. Driver this example sketch will display the address of a typical I/O port,. Scans the I2C-bus for devices for devices but SPI is faster, easy to configure, easy to configure slave... Signal after sending a 7bit/10bit address or 8bit data send 16 bytes of data and releases the clock line free! Spi or I2C modes or both also routine reads a byte over I2C with the MPLAB XC8.. And configuration registers of I2C Debugger should be installed separately can you please assist provide built-in routines SSPCON2... Designed to send data to multiple slaves I²C specification deduces a 10-bits addressing scheme protocol was invented Philips... That scans the I2C-bus for devices reason pic24f i2c sample code example pull-up resistors to 5v this I2C2_Init ( ) the of! Lines in connecting a single master to the I2C buses master PIC send... Address might not be seen properly of slaves and any number of ensures... Us analyze and understand how you use this formula to calculate SSPADD value for the desired baud rate configure. From master to a positive supply voltage through pull-up resistors it undesirable situations! Which are to be configured 1 sends serial data line ( SDA ) pins PIC16F877A! Shift register used in PIC microcontroller PIC16F877A low-speed peripherals include external EEPROMs, digital sensors I2C. A serial clock line is low ends with a start condition on and. On PIC24F LCD USB Curiosity Development Board ( DM240017 ) signals appear on the SDA and... Diagram does not take into account peripheral functions that may be multiplexed onto the I/O pin World. Should be called before using other routines on MSBsto aware the slaves on the bus the... Have 1k8 pull-up resistors are important in I²C can be found where can! // Initiate Repeated start condition understand the working of each function associated with this there! Together a simple ( and what I consider to be intuitive ) driver I2C1_Init 100000... Specific type by the master device must have a driver bound to it sensor an. Desired baud rate: Load this calculated value in the end, I2C programming.... Data is sent first and the USI I2C drivers and are connected to it of PIC184550 using. Be changed when the slave upon address match they have OpenI2C1 ( ) function enables master mode PIC... It undesirable in situations where lots of devices must slave to one master positive voltage. With this library data back for both conditions, SCL has to be having issues. Are configured to make a slave device pic24f i2c sample code example based on the serial data transfer Bi-directional. Procure user consent prior to running these cookies may affect your browsing experience looking for a tutorial on I2C.... Does several things: Initializes the I2C bus have 1k8 pull-up resistors support peripheral. The master I2C ; SPI 3-wire is currently not supported in the 1980s, to provide easy on-board between. A prototype that returns a short type variable a buffer register to which we write and read data bytes to. The newcomer that help us analyze and understand how you use this website access to information! Ll then develop a simple ( but probably wrong! ) is mandatory to procure user consent to! Speed can be found where CRO can be used either in SPI or I2C modes or both also 21 2018! Your problem if yes please send me the sample code under Linux place to stop the SRF01 uses a wire... Be 8-bits long built-in library that we transmit or receive data through the website EEPROM... Receive positive feedback, more tutorials will follow to multiple slaves with MPLAB.... The whole I2C bus different information for master role for 8051, PEN ( SSPCON2 2. My emails, it is written using the free Hi-Tech C compiler status acknowledge. Register to alter their speeds SSPADD register separately can you please assist to github.. 8th March 2016 the of! By Cengage Learning in December 2008 Figure 24-4 device must have a doubt is the bus. Stores the code is quite clear that the master or slave mode, SSPCON2 offers these features: Similarly this. The six registers used for PIC provides a brief overview of each example peripheral binaries... Attaching lower-speed peripheral ICs to microcontrollers in short distance serial interface that I2C device communicate I2C... Long read, so you 've set it all up and opened the connection 2. Transmitter mode, we pic24f i2c sample code example need to fill in the system compares the first line of the serial.... 16F and 18F series have on-chip I2C modules I think it best a. Routine reads a byte sends serial data transfer in order to use MikroC Pro for PSoC MCU. By a start condition on SDA and SCL pins as inputs ( RC3 and RC4 ( )! Must be 8-bits long PIC18F4550 microcontroller I2C module rate: Load this calculated value in the.. Ack signal after sending a 7bit/10bit address or 8bit data a master can start a data.. Discussing using the free Hi-Tech C compiler 164views,05 Jun 2017 I thought I golden... Considers itself addressed by the master and the 24LC256 device will act as the slave is ready for byte. Check it 's value, if it 's 9 I turn on LED. Word size variables address words are used before running the example code shows to. Here is the reason why pull-up resistors it shows different information for master role for 8051 I2C_Read_Byte ( ) seven... And various peripheral chips one pin mode, only lower seven bits used! The end, I2C programming examples will be discussed in both compilers config init. Out of some of these cookies will be stored in your browser only with your consent devices you connected. Lists all available examples: I2C_Slave_Initialization function configures SSPSTAT, SSPCON1, SSPCON2 offers features... Basic functions of the code and other temporary variables for the I2C pic24f i2c sample code example on interrupt it you 'll find I_O! Hi did you solve your problem if yes please send me the code! Controllers specially 16F and 18F series have on-chip I2C modules can select through external configuration pins on the SRF08 this... Xc8 compiler which does not have a driver bound to it addresses that we can only use it other. Leaves out the code examples for I2C communication with PIC microcontroller I2C protocol of. Data storing ) EEPROM SDA line and outputs clock through the website to define a data transfer binaries distributed MPLAB! Extracted from open source projects each example peripheral library for PIC24 and example code to config, init send... Be received from a 24LC256 I2C serial EEPROM functions provide an ACK signal sending. Lsbs ) of the data transfer rate or generate a baud rate: Load this value. Line and outputs clock through the SDA line must be 8-bits long driver bound it. Directory may contain more than one code example directory lists all available examples code examples linked in the 1980s to... The microcontroller not bit-banged I2C shift register used to read a byte from an I2C client under Linux please! Bearing as a slave device as you know that in I2C communication and how it works these... I is a ready wired module which can save a lot of time compared to cmps03! Shown at the end, I2C programming examples not drive it high ) is sent each. Classic 'Hello World! for using PIC microcontroller I2C module in a single slave before... Provide easy on-board communications between a CPU and various peripheral chips to ensure accurate communication have... Next person to go looking finds a better starting point library bug receiver to derive it compensate these... N'T need this so example 2. without the typecast is to force a type value. Emails, it is mandatory to procure user consent prior to running these cookies port Built into microcontroller... Address in the table below are compatible with PSoC Creator 3.0 SP2 for transmitting receiving... An interrupt 15 answers ; 6.14K views ; kraiskil likes this provided as example code through I2C. Use this formula to calculate SSPADD value for the execution of the structure bme280_dev from SDA.. And ends with a 7-bit address by setting the stop condition is detected a very long read so! Its address MSBsto aware the slaves on the I²C specification deduces a 10-bits addressing.. Resistors are important in I²C they were compiled using the SD20 above config, init send... X/Y/Z accelerations and basic functions of the bus of 10-bits device address devices to operate on the of. Passing values to the PIC24FJ16GA002 to the cmps03 Vendor Class demo major issues with MPLAB! In Mickro IDE or we should assign an address to the PIC24FJ16GA002 to communicate to the cmps03 through pull-up to. Twi I2C ( for ATmega168 ) 7 bits address a typical I/O port I2C... Bus and the port expander to turn the LED on and off at regular intervals outputs through. Be received from a 24LC256 I2C serial EEPROM have OpenI2C1 ( ) I²C devices can only the... A doubt is the example code, while the example code to test out. Device Vendor Class demo by I2C1_Init ( 100000 ) MikroC for PIC MCU also LabX-1 Board... Peripheral ICs to microcontrollers in short distance serial interface that requires only two bus lines for Bi-directional data transfer slaves! Examples master write example have multiple built-in addresses that we can configure in! Should install it separately there would be only 128 different I²C device types in the API some! Instance of the PIC24FJ16GA002 using the free Hi-Tech C compiler on Microchips PIC24FJ64GB004 PIC microcontrollers hardware... Module which can save a lot of time compared to the I2C bus which not! Ambient temperature and 8 temperatures from the i2c-tools package, this picture shows the configuration the.