Difference between revisions of "Component: I2C Slave (Comms: Interface)"
From Flowcode Help
Jump to navigationJump to search (XML import)  | 
				|||
| (16 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
| − | + | {| style="width:50%"  | |
| − | |||
| − | {|   | ||
|-  | |-  | ||
| − | | width="20%" style="color: gray;" | Author  | + | | width="20%" style="color:gray;" | Author  | 
| Matrix Ltd.  | | Matrix Ltd.  | ||
|-  | |-  | ||
| − | | width="20%" style="color: gray;" | Version  | + | | width="20%" style="color:gray;" | Version  | 
| − | | 1.3   | + | | 1.3  | 
|-  | |-  | ||
| − | | width="20%" style="color: gray;" | Category  | + | | width="20%" style="color:gray;" | Category  | 
| Comms: Interface  | | Comms: Interface  | ||
|}  | |}  | ||
| − | + | ==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==  | |
| − | ==  | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | ''No detailed description exists yet for this component''  | |
| − | + | ==Examples==  | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| + | ''<span style="color:red;">No additional examples</span>''  | ||
| − | + | ==Macro reference==  | |
| − | :''  | + | ===Check_Status===  | 
| + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Check_Status'''  | ||
| + | |-  | ||
| + | | colspan="2" | 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)   | ||
| + | |-  | ||
| + | |-  | ||
| + | | 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''  | ||
| + | |}  | ||
| + | ===Initialise===  | ||
| + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''  | ||
| + | |-  | ||
| + | | colspan="2" | 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.   | ||
| + | |-  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID  | ||
| + | | width="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
| + | |}  | ||
| − | |||
| − | ''  | + | ===ReceiveByte===  | 
| + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | ||
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveByte'''  | ||
| + | |-  | ||
| + | | 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="90%" | Last  | ||
| + | |-  | ||
| + | | 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="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
| + | |}  | ||
| − | ==  | + | ===TransmitByte===  | 
| − | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | |
| + | |-  | ||
| + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]  | ||
| + | | 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.   | ||
| + | |-  | ||
| + | |-  | ||
| + | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE  | ||
| + | | width="90%" | Data  | ||
| + | |-  | ||
| + | | 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="90%" style="border-top: 2px solid #000;" | ''Return''  | ||
| + | |}  | ||
| − | |||
| − | + | ==Property reference==  | |
| − | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;"  | |
| − | + | |-  | |
| − | + | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]  | |
| − | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''    | |
| − | Baud rate option selector  | + | |-  | 
| − | + | |-  | |
| − | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]  | |
| − | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Bus Settings  | |
| − | + | |-  | |
| − | + | |-  | |
| − | Baud rate to be used  | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]  | 
| − | + | | width="90%" | Channel  | |
| − | + | |-  | |
| − | + | | colspan="2" | Channel selection   | |
| − | + | |-  | |
| − | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]  | |
| − | On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not    | + | | width="90%" | Baud Select  | 
| − | + | |-  | |
| − | a 10ms delay between an I2C stop event and the next I2C start event.  | + | | colspan="2" | Baud rate option selector   | 
| − | + | |-  | |
| − | + | | width="10%" align="center" | [[File:Fc9-type-14-icon.png]]  | |
| − | + | | width="90%" | Baud Rate  | |
| − | Most modern microcontrollers will not have a problem so this property can be disabled to speed up the    | + | |-  | 
| − | + | | colspan="2" | Baud rate to be used   | |
| − | I2C communications.  | + | |-  | 
| − | + | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]]  | |
| − | + | | width="90%" | Stop Delay  | |
| − | + | |-  | |
| − | + | | 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="90%" | Slave Address  | |
| − | + | |-  | |
| − | + | | colspan="2" |    | |
| − | 0 - don't care;  | + | |-  | 
| − | + | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]]  | |
| − | 1 - perform match;  | + | | width="90%" | Mask  | 
| − | + | |-  | |
| − | 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:#EAE1EA;" | [[File:Fc9-conn-icon.png]]  | |
| − | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections  | |
| − | + | |-  | |
| − | + | |-  | |
| − | Pin used for SDA (data signal)  | + | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]  | 
| − | + | | width="90%" | SDA  | |
| − | + | |-  | |
| − | + | | colspan="2" | Pin used for SDA (data signal)   | |
| − | + | |-  | |
| − | + | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]]  | |
| − | Pin used for SCL (clock signal)  | + | | width="90%" | SCL  | 
| − | + | |-  | |
| − | + | | colspan="2" | Pin used for SCL (clock signal)   | |
| − | + | |-  | |
| − | + | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]  | |
| − | + | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation  | |
| − | Label shown on the comms flasher on the simulation panel.  | + | |-  | 
| − | + | |-  | |
| − | + | | width="10%" align="center" | [[File:Fc9-type-10-icon.png]]  | |
| − | + | | width="90%" | Label  | |
| − | + | |-  | |
| − | + | | colspan="2" | Label shown on the comms flasher on the simulation panel.   | |
| − | Selects if the scope traces are automatically generated or not  | + | |-  | 
| − | + | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]]  | |
| − | + | | width="90%" | Scope Traces  | |
| − | + | |-  | |
| − | + | | colspan="2" | Selects if the scope traces are automatically generated or not   | |
| − | + | |-  | |
| − | Selects if the console data is automatically generated or not  | + | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]]  | 
| − | + | | width="90%" | Console Data  | |
| − | + | |-  | |
| − | + | | colspan="2" | Selects if the console data is automatically generated or not   | |
| − | + | |-  | |
| − | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]]  | |
| − | + | | width="90%" | API  | |
| + | |-  | ||
| + | | colspan="2" |    | ||
| + | |}  | ||
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