Difference between revisions of "Component: I2C Slave (Comms: Interface)"
From Flowcode Help
Jump to navigationJump to search| (15 intermediate revisions by one other user not shown) | |||
| Line 14: | Line 14: | ||
==I2C Slave component==  | ==I2C Slave component==  | ||
Generic Two Wire I2C Communications Interface  | Generic Two Wire I2C Communications Interface  | ||
| + | |||
| + | ==Component Source Code==  | ||
| + | |||
| + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_I2C_Slave.fcfx FC_Comp_Source_I2C_Slave.fcfx]  | ||
| + | |||
| + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_I2C_Slave.fcfx FC_Comp_Source_I2C_Slave.fcfx]  | ||
==Detailed description==  | ==Detailed description==  | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
''No detailed description exists yet for this component''  | ''No detailed description exists yet for this component''  | ||
| Line 22: | Line 50: | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | ''<span style="color:red;">No additional examples</span>''  | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| + | ==Macro reference==  | ||
| + | ===Check_Status===  | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
|-  | |-  | ||
| Line 94: | Line 77: | ||
| + | ===Initialise===  | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
|-  | |-  | ||
| Line 107: | Line 91: | ||
| + | ===ReceiveByte===  | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
|-  | |-  | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''  | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveByte'''  | 
|-  | |-  | ||
| − | | colspan="2" |   | + | | colspan="2" | 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   | 
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|-  | |-  | ||
|-  | |-  | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE  | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE  | ||
| − | | width="90%" |   | + | | width="90%" | Last  | 
|-  | |-  | ||
| − | | colspan="2" |   | + | | colspan="2" | Used to signify the last byte when streaming incoming data. 0=Not last byte, 1=Last Byte   | 
|-  | |-  | ||
| − | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE  | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-  | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return''  | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
|}  | |}  | ||
| + | ===TransmitByte===  | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
|-  | |-  | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''  | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''TransmitByte'''  | 
| − | |||
| − | |||
|-  | |-  | ||
| − | + | | colspan="2" | 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.   | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | | colspan="2" |   | ||
|-  | |-  | ||
|-  | |-  | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE  | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE  | ||
| − | | width="90%" |   | + | | width="90%" | Data  | 
|-  | |-  | ||
| − | | colspan="2" |   | + | | colspan="2" | Data byte to send on the I²C bus.   | 
|-  | |-  | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE  | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE  | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return''  | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
|}  | |}  | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| Line 208: | Line 135: | ||
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]  | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]  | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''    | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''    | ||
| + | |-  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]  | ||
| + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Bus Settings  | ||
|-  | |-  | ||
|-  | |-  | ||
| Line 229: | Line 160: | ||
|-  | |-  | ||
| colspan="2" | 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.    | | colspan="2" | 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.    | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]  | ||
| + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Slave Setttings  | ||
| + | |-  | ||
|-  | |-  | ||
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]  | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]]  | ||
| Line 240: | Line 175: | ||
| colspan="2" | 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   | | colspan="2" | 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   | ||
|-  | |-  | ||
| − | | width="10%" align="center" style="background-color:#  | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]  | 
| − | | width="90%" style="background-color:#  | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections  | 
|-  | |-  | ||
|-  | |-  | ||
| Line 254: | Line 189: | ||
| colspan="2" | Pin used for SCL (clock signal)   | | colspan="2" | Pin used for SCL (clock signal)   | ||
|-  | |-  | ||
| − | | width="10%" align="center" style="background-color:#  | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]  | 
| − | | width="90%" style="background-color:#  | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation  | 
|-  | |-  | ||
|-  | |-  | ||
Latest revision as of 10:16, 16 January 2024
| Author | Matrix Ltd. | 
| Version | 1.3 | 
| Category | Comms: Interface | 
Contents
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
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. | |
| Return | |
ReceiveByte
TransmitByte