Rei Vilo's fischertechnik Corner
  • About
  • Blog
  • Reviews
    • How to Start?
    • Controllers >
      • Robotics TXT
      • TXT 4.0 Controller
      • Bluetooth Smart Beginner Set
      • Interface Boards for fischertechnik Models
      • Didacta Advance Pi-F5 interface board
    • Sets >
      • Technical Revolutions Set
      • Pneumatic Power Set
      • Automation Robots Set
      • Electro-Pneumatic Set
      • Starter Set for micro:bit
      • Bluetooth Smart Beginner Set
      • Robotics TXT Smart Home Set
    • Exploring the Lego World >
      • Purchasing
      • Unboxing
      • Installing
      • Building
      • Programming
      • Connecting
      • Playing
      • Expanding
      • Concluding
  • Models
    • Back to the 70's
    • Micro Models
    • New Magasin >
      • Magasin releases 1, 2 and 3
      • Long X-Axis
      • Moving Desk And Y-Axis
      • Compressed Air And Vacuum For Z-Axis
      • Pictures
      • Specifications
    • Power Saving White LED
    • Flipper with I²C LCD Panel
    • Celebrating 50 Years!
    • ft Convention 2013
    • ft Convention 2014
  • Sensors
    • Interfacing an Arduino to a Robo TX Controller >
      • Analog Interface
      • Digital Interface
      • I²C Interface
    • Standard Sensors >
      • Playing With Accelerometers
      • Proximity Sensor
      • Pressure Sensor
    • Advanced Sensors >
      • Industrial Colour Reader
      • Stepper Motor Controller
      • DC-Motor with Quadrature Encoder Controller
    • smartDevices >
      • smartColours
      • smartRFID
      • smartLED
      • smartHub
      • smartControls
      • smartMeter
      • smartCamera
      • smartNewCamera
      • smartWiFi
      • smartBLE
      • smartNode
      • smartIMU
  • RoboPro
    • Value Operations >
      • Min and Max Functions
      • Signal Management With Median
      • Modulo Function
      • Map Function
    • Standard Modules >
      • Software Managed Compressor
      • Self-Calibrated Colour-Reader
      • Standard Conveyor Belt Routine
      • Management Panel
      • Encoder-Motor Position Management
    • Variable Types >
      • CSV List Management
      • Queue Function
    • Program Structures >
      • Parallel Processing
      • Multi-Tasking End Management Procedure
    • Tutorials >
      • Setting Bluetooth LAN with Multiple TX-Cs
      • Dealing with Very Large Models >
        • Getting a General View
        • Defining User's Functions
        • Elaborating the Modelisation
        • Defining the Processes
        • Setting the Messages
        • Going Further
        • References
      • Program Error 2 Message
  • I²C
    • How to Connect an I²C Device to the Robo TX?
    • How to Connect an I²C Device to the Robotics TXT?
    • How to Manage an I²C Device?
    • How to Use an I²C Driver?
    • List of I²C Drivers for Sensors >
      • I²C Real Time Clock DS1307
      • I²C LCD screen 4 lines of 20 characters LCD03
      • I²C Triple Axis Accelerometer ADXL345
      • I²C Red-Green-Blue LED BlinkM
      • I²C Two Axis Compass HMC6352
      • I²C Triple Axis Magnetometer HMC5843
      • I²C True Colour Sensor ADJD-S371
      • I²C Stepper Controller AMIS-30624
    • List of I²C Drivers for smartDevices >
      • I²C True Colours Smart Sensor smartColours
      • I²C RFID Smart Sensor smartRFID
      • I²C 4-Digit 7-Segment LED Display smartLED
      • I²C Screen With Touch and SD-Card smartControls
      • I²C Smart Sensor smartCamera
      • I²C Smart Sensor smartNewCamera
      • I²C Remote WiFi Interface smartWiFi​
      • I²C Remote Bluetooth Interface smartBLE​
      • I²C Remote Interface smartNode​
      • I²C New LCD Screen 4 x 20 characters smartLCD
      • I²C Inertial Measurement Unit smartIMU

How to Manage an I²C Device?

Starting release 3.1.3, fischertechnik Robo Pro supports I²C devices and brings new dedicated functions.I²C devices are highly versatile and can be 
  • sensors —a thermometer, 
  • actuators —a LCD display, a stepper controller,
  • or combined —a screen with touch.

The write and read functions required level 4 and are located under the send / receive group.
​

Keep in mind:
  • The RoboTX controller with RoboPro 3.1.3 and later fully supports MultiMaster (one slave can hold the bus by keeping the clock line low) and I²C fast mode (400 kHz).
  • The Robotics TXT controller with RoboPro 4.2.4 has an issue with speed, as it switches I²C standard mode (100 kHz) to I²C fast mode (400 kHz).
  • The 0x50~0x57 addresses are already used by the RoboTX and Robotics TXT controllers.

​Some I²C devices that work with the RoboTX controller may not work or work improperly with the Robotics TXT controller.
Picture

Write Function

Picture
  • Device address is the unique address of the I²C device, from 0 to 127 or 0x00 to 0x7f. The 0x50 and 0x54 addresses are reserved.
  • Sub-address could be, 8 bits or 16 bits —either MSB=most significant byte first or LSB=least significant byte first.
  • Data could be 8 bits or 16 bits —either MSB=most significant byte first or LSB=least significant byte first.
  • Data value could be either typed-in or imported.
  • Speed is either 100 kHz or 400 kHz. Most I²C devices run at 100 kHz, and some at 400 kHz. Take 100 kHz as default.
  • The error handling offers three option: Repeat until success, Repeat 10 times and Abort immediately. The Repeat 10 times and Abort immediately options add another exit branch to the function in case of an error for error handling.
  • Keep open allows to send more than one byte. If checked, next write function continues sending byte on the flow. This is very handy for sending text to a screen.

For more detailed informations, please refer to chapter 8.2.7 of the Robo Pro help.

Read Function

Picture
  • Device address is the unique address of the I²C device, from 0 to 127 or 0x00 to 0x7f. The 0x50 and 0x54 addresses are reserved.
  • Sub-address could be none, 8 bits or 16 bits —either MSB=most significant byte first or LSB=least significant byte first.
  • Data could be 8 bits or 16 bits —either MSB=most significant byte first or LSB=least significant byte first.
  • Data value could be either typed-in or imported.
  • Speed is either 100 kHz or 400 kHz. Most I²C devices run at 100 kHz, and some at 400 kHz. Take 100 kHz as default.
  • The error handling offers three option: Repeat until success, Repeat 10 times and Abort immediately. The Repeat 10 times and Abort immediately options add another exit branch to the function in case of an error for error handling.
  • Keep open allows to send more than one byte. If checked, next read function continues taking byte from the flow. 

For more detailed informations, please refer to chapter 8.2.7 of the Robo Pro help.

Write or Read Mode Than Two Bytes

Let's take the example of the DS1307 real time clock.  Both programs below are identical: 
  • On the left, the address of the register is set for each command
  • On the right, the address of the register is set for the first command only and the sequence is kept open. Note the O for open.
Picture
Reading one or two bytes
Picture
Reading more than two bytes in a sequence

To read more than 2 bytes, the keep open feature is used. In the case of the DS1307 real time clock, when a register is read, the internal address is incremented by one. So the next read command gets the next value.

Each I²C device has its own registers and commands set, explained in the data-sheet.

First command

Following commands 

Last command

Picture
Picture
Picture
The first command defines the device address and the sub-address. The sub-address may correspond to the address of a register of the device, or to a command for the device.
​
  • Keep open is checked. 

This first command opens a read sequence.

In the following commands, there's no need to set the sub-address.

Here, another byte is read.
​
  • Keep open is kept checked. 
The only difference with the last command is that keep open is unchecked, and thus closes the read sequence.

  • Keep open is unchecked. 

Sounds complicated? Actually, it is. But there's a plug-and-play solution: the driver.

Operations Cycle

Using an I²C device always relies on the same operations cycle:
  • Initialisation: parameters to set the I²C device.
  • Use: read or / and write operations.
  • End: optionally, at the end.

A driver packs all the functions for a full operation cycle.

Previous

  • How to connect an I²C Device to the Robo TX?​
  • How to connect an I²C Device to the Robotics TXT?

Next

  • How to Use an I²C Driver?
Powered by Create your own unique website with customizable templates.