Main Content

C28x I2C Transmit

Configure inter-integrated circuit (I2C) module to transmit data to I2C bus

  • C28x I2C Transmit block

Libraries:
C2000 Microcontroller Blockset / C2802x
C2000 Microcontroller Blockset / C2803x
C2000 Microcontroller Blockset / C2805x
C2000 Microcontroller Blockset / C2806x
C2000 Microcontroller Blockset / C280x
C2000 Microcontroller Blockset / C2833x
C2000 Microcontroller Blockset / C2834x
C2000 Microcontroller Blockset / F280013x
C2000 Microcontroller Blockset / F280015x
C2000 Microcontroller Blockset / F28002x
C2000 Microcontroller Blockset / F28003x
C2000 Microcontroller Blockset / F28004x
C2000 Microcontroller Blockset / F2807x
C2000 Microcontroller Blockset / F2837xD
C2000 Microcontroller Blockset / F2837xS
C2000 Microcontroller Blockset / F2838x / C28x
C2000 Microcontroller Blockset / F28M35x / C28x
C2000 Microcontroller Blockset / F28M36x / C28x
C2000 Microcontroller Blockset / F28p65x
C2000 Microcontroller Blockset / F28p55x

Description

The I2C Transmit block configures the inter-integrated circuit (I2C) module to transmit data to the two-wire I2C serial bus. The I2C Transmit block supports I2C bus communication between the processor and external peripherals or other controllers. The block can run in either peripheral or controller mode.

When the I2C module is configured as controller, the module receives data from a peripheral. When the I2C module is configured as a peripheral, the module receives data from the controller. Configure the I2C module by navigating to Configuration Parameters > Hardware Implementation > Target hardware resources.

To read data from a peripheral, send the address of the register to be read using the I2C Transmit block to the peripheral. Ensure that the data is sent from the Tx FIFO to the peripheral before the data is read from the peripheral using the I2C Receive block. For more information, see Using the I2C Bus to Access Sensors.

Examples

Ports

Input

expand all

The peripheral address register value.

Dependencies

This port appears only when peripheral address source is set to Input port.

Data Types: int8 | uint8 | int16 | uint16 | int32 | uint32 | single | double | Boolean

The data written to the I2C bus.

Data Types: int8 | uint8 | int16 | uint16 | int32 | uint32

Output

expand all

Status values from the I2C status register (I2CSTR).

Dependencies

This port appears only when Output transmitting status is selected.

Data Types: uint16

Parameters

expand all

The I2C module to be used for communication. The number of I2C modules supported varies across different C2000™ processors.

The address format for communication. The diagram shows the format for each option. The I2C Transmit block sets the R/W bit to 1.

S — Start bit

R/W — Read/Write

ACK — Acknowledge

P — Stop bit

MSB — Most significant bit

LSB — Least significant bit

The method for setting the peripheral address register of the I2C peripheral.

Enter a 7- or 10-bit peripheral address according to the addressing format selected.

Dependencies

This parameter appears only when Peripheral address source is set to Specify via dialog.

The number of bits in the data byte received by the I2C module.

When the I2C module is configured as controller, the I2C module sends out a stop bit to the I2C bus to indicate that the data transmission is complete. The I2C bus is free for any other I2C module to initiate a read/write operation.

When you enable repeat mode, the I2C module transmits data continuously until it detects a stop or start condition. If you use this mode, also consider selecting Enable stop condition to ensure that data transmit stops after the stop condition.

If you disable repeat mode, the I2C module operates in standard mode, sending a specific number of data values once.

Enables the status output port, which indicates when the I2C transmit block transmits a message.