Jump to content

Component: I2C Slave (Comms: Interface)

From Flowcode Help
Revision as of 14:23, 13 July 2026 by SteveT (talk | contribs) (Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead"")
Author Matrix Ltd.
Version 1.3
Category Comms: Interface


I2C Slave component

Generic Two Wire I2C Communications Interface

Component Source Code

Please click here to download the component source project: FC_Comp_Source_I2C_Slave.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_I2C_Slave.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples

Macro reference

Check_Status

Check_Status
Returns the Slave Status. Bit 0 = 1 Indicates address/data byte available in the buffer to read Bit 5 = 1 Indicates that the last byte received or transmitted was data (else address) 
- BYTE Return


Initialise

Initialise
Enables the I²C hardware and performs some initialization. Should be called at the start of the program or at least before any of the other I²C functions are called. 
- VOID Return


ReceiveByte

ReceiveByte
Receives a byte from the I²C bus. Returns the data received, and sends either Ack or Nak Set parameter Last as: 1=Last=Nak, 0=Ack=More 
- BYTE Last
Used to signify the last byte when streaming incoming data. 0=Not last byte, 1=Last Byte 
- BYTE Return


TransmitByte

TransmitByte
Sends a byte on the I²C bus. Returns the acknowledge if any. 0 represents that data was acknowledged and 1 represents no acknowledge was detected. 
- BYTE Data
Data byte to send on the I²C bus. 
- BYTE Return


Property reference

Properties
Bus Settings
Channel
Channel selection 
Baud Select
Baud rate option selector 
Baud Rate
Baud rate to be used 
Stop Delay
On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not a 10ms delay between an I2C stop event and the next I2C start event. Most modern microcontrollers will not have a problem so this property can be disabled to speed up the I2C communications.  
Slave Setttings
Slave Address
 
Mask
0 - don't care; 1 - perform match; So address of 0x30 and mask of 0xF0 will allow the slave to respond to addresses of 0x30, 0x31, 0x32, …, 0x3F 
Connections
SDA
Pin used for SDA (data signal) 
SCL
Pin used for SCL (clock signal) 
Simulation
Label
Label shown on the comms flasher on the simulation panel. 
Scope Traces
Selects if the scope traces are automatically generated or not 
Console Data
Selects if the console data is automatically generated or not 
API