Component: I2C Free (Peripheral CAL): Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 16: | Line 16: | ||
==Component Source Code== | ==Component Source Code== | ||
Please click here to download the component source project: [https://www.flowcode.co.uk/wikicopy/componentsource/FC_Comp_Source_I2C_Free.fcfx FC_Comp_Source_I2C_Free.fcfx] | |||
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_I2C_Free.fcfx FC_Comp_Source_I2C_Free.fcfx] | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_I2C_Free.fcfx FC_Comp_Source_I2C_Free.fcfx] | ||
==Detailed description== | ==Detailed description== | ||
| Line 42: | Line 46: | ||
==Examples== | ==Examples== | ||
| Line 67: | Line 73: | ||
==Macro reference== | ==Macro reference== | ||
{| 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;" | '''Slave_Uninit''' | |||
|- | |||
| colspan="2" | Uninitialise the Slave | |||
|- | |||
|- | |||
| 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'' | |||
|} | |||
{| 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;" | '''GetValue''' | |||
|- | |||
| colspan="2" | Get the Named property value. | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" | Name | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
{| 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;" | '''Master_Stop''' | |||
|- | |||
| colspan="2" | Output a Master Stop | |||
|- | |||
|- | |||
| 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'' | |||
|} | |||
{| 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;" | '''Slave_Init''' | |||
|- | |||
| colspan="2" | Initialise the Slave with the given Address, or range of Addresses. Only address bits that have a corresponding bit set in the Mask will be compared with the incoming bus address. | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Address | |||
|- | |||
| colspan="2" | 7 Bit Address of this device (Bit 0 is ignored) | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Mask | |||
|- | |||
| colspan="2" | Bit mask used to compare addresses | |||
|- | |||
| 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'' | |||
|} | |||
{| 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;" | '''Master_Uninit''' | |||
|- | |||
| colspan="2" | Uninitialise the Master | |||
|- | |||
|- | |||
| 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'' | |||
|} | |||
{| 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;" | '''Slave_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'' | |||
|} | |||
{| 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;" | '''GetConsoleHandle''' | |||
|- | |||
| colspan="2" | Obtains the CAL console handle | |||
|- | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-h32-icon.png]] - HANDLE | |||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | |||
|} | |||
{| 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;" | '''Slave_TxByte''' | |||
|- | |||
| colspan="2" | Send a data byte, returns Ack/Nak from Master 0=Ack=More, 1=Nak=Last | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Data | |||
|- | |||
| colspan="2" | | |||
|- | |||
| 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'' | |||
|} | |||
{| 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;" | '''Slave_RxByte''' | |||
|- | |||
| colspan="2" | 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" | Sends Ack if 0, else Nak | |||
|- | |||
| 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'' | |||
|} | |||
{| 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;" | '''SetValue''' | |||
|- | |||
| colspan="2" | Change Named property to new Value. If "CHANNEL" the ports will be also updated from the fcd | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" | Name | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" | Value | |||
|- | |||
| colspan="2" | port value as string | |||
|- | |||
| 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'' | |||
|} | |||
{| 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;" | '''Master_Init''' | |||
|- | |||
| colspan="2" | Initialise the Master | |||
|- | |||
|- | |||
| 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'' | |||
|} | |||
{| 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;" | '''Master_Start''' | |||
|- | |||
| colspan="2" | Output a Master Start sequence | |||
|- | |||
|- | |||
| 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'' | |||
|} | |||
{| 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;" | '''Master_TxByte''' | |||
|- | |||
| colspan="2" | Send a data byte | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Data | |||
|- | |||
| colspan="2" | | |||
|- | |||
| 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'' | |||
|} | |||
{| 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;" | '''Master_Restart''' | |||
|- | |||
| colspan="2" | Output a Master Restart sequence | |||
|- | |||
|- | |||
| 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'' | |||
|} | |||
{| 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;" | '''Master_RxByte''' | |||
|- | |||
| colspan="2" | Returns a received data byte. Set Last=0 if there is following more Master_RxByte macros Set Last=1 if this is the last Master_RxByte and it is followed with Master_Stop. If Last = 1 the I2C bus will be presented with a 'Nack' condition. | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | |||
| width="90%" | Last | |||
|- | |||
| colspan="2" | Range: 0-1 - 0 = Not the last byte to receive, 1 = last byte to receive | |||
|- | |||
| 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'' | |||
|} | |||
{| 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;" | '''GetList''' | |||
|- | |||
| colspan="2" | returns Named property List as filter string | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | |||
| width="90%" | Name | |||
|- | |||
| colspan="2" | | |||
|- | |||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING | |||
| 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''' | |||
|- | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | Channel | |||
|- | |||
| colspan="2" | Channel selection | |||
|- | |||
| 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]] | |||
| width="90%" | SCL | |||
|- | |||
| colspan="2" | Pin used for SCL (clock signal) | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | Baud Select | |||
|- | |||
| colspan="2" | Baud rate option selector | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]] | |||
| width="90%" | Baud Rate | |||
|- | |||
| colspan="2" | Baud rate to be used | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | Slew Rate Control | |||
|- | |||
| colspan="2" | Slew Rate Control Enabled or Disabled | |||
|- | |||
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |||
| width="90%" | SMBus Inputs | |||
|- | |||
| colspan="2" | When Enabled input logic thresholds are compliant with SMBus specification | |||
|- | |||
| 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;" | Simulation | |||
|- | |||
|- | |||
| 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 | |||
|- | |||
| 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 | |||
|}==Macro reference== | |||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
Revision as of 15:22, 20 January 2023
| Author | Matrix Ltd |
| Version | 1.3 |
| Category | Peripheral CAL |
I2C Free component
Chip Abstraction Layer for Two Wire I2C Communications
Component Source Code
Please click here to download the component source project: FC_Comp_Source_I2C_Free.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_I2C_Free.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Example showing how to build a component using a CAL component Using CAL Components.
Macro reference
| Slave_Uninit | |
| Uninitialise the Slave | |
| Return | |
| GetValue | |
| Get the Named property value. | |
| Name | |
| Return | |
| Master_Stop | |
| Output a Master Stop | |
| Return | |
| Master_Uninit | |
| Uninitialise the Master | |
| Return | |
| GetConsoleHandle | |
| Obtains the CAL console handle | |
| Return | |
| Slave_TxByte | |
| Send a data byte, returns Ack/Nak from Master 0=Ack=More, 1=Nak=Last | |
| Data | |
| Return | |
| Slave_RxByte | |
| Returns the data received, and sends either Ack or Nak Set parameter Last as: 1=Last=Nak, 0=Ack=More | |
| Last | |
| Sends Ack if 0, else Nak | |
| Return | |
| SetValue | |
| Change Named property to new Value. If "CHANNEL" the ports will be also updated from the fcd | |
| Name | |
| Value | |
| port value as string | |
| Return | |
| Master_Init | |
| Initialise the Master | |
| Return | |
| Master_Start | |
| Output a Master Start sequence | |
| Return | |
| Master_TxByte | |
| Send a data byte | |
| Data | |
| Return | |
| Master_Restart | |
| Output a Master Restart sequence | |
| Return | |
| GetList | |
| returns Named property List as filter string | |
| Name | |
| Return | |
Property reference
==Macro reference==
| Slave_Uninit | |
| Uninitialise the Slave | |
| Return | |
| GetValue | |
| Get the Named property value. | |
| Name | |
| Return | |
| Master_Stop | |
| Output a Master Stop | |
| Return | |
| Master_Uninit | |
| Uninitialise the Master | |
| Return | |
| GetConsoleHandle | |
| Obtains the CAL console handle | |
| Return | |
| Slave_TxByte | |
| Send a data byte, returns Ack/Nak from Master 0=Ack=More, 1=Nak=Last | |
| Data | |
| Return | |
| Slave_RxByte | |
| Returns the data received, and sends either Ack or Nak Set parameter Last as: 1=Last=Nak, 0=Ack=More | |
| Last | |
| Sends Ack if 0, else Nak | |
| Return | |
| SetValue | |
| Change Named property to new Value. If "CHANNEL" the ports will be also updated from the fcd | |
| Name | |
| Value | |
| port value as string | |
| Return | |
| Master_Init | |
| Initialise the Master | |
| Return | |
| Master_Start | |
| Output a Master Start sequence | |
| Return | |
| Master_TxByte | |
| Send a data byte | |
| Data | |
| Return | |
| Master_Restart | |
| Output a Master Restart sequence | |
| Return | |
| GetList | |
| returns Named property List as filter string | |
| Name | |
| Return | |
Property reference
==Macro reference==
| Slave_Uninit | |
| Uninitialise the Slave | |
| Return | |
| GetValue | |
| Get the Named property value. | |
| Name | |
| Return | |
| Master_Stop | |
| Output a Master Stop | |
| Return | |
| Master_Uninit | |
| Uninitialise the Master | |
| Return | |
| GetConsoleHandle | |
| Obtains the CAL console handle | |
| Return | |
| Slave_TxByte | |
| Send a data byte, returns Ack/Nak from Master 0=Ack=More, 1=Nak=Last | |
| Data | |
| Return | |
| Slave_RxByte | |
| Returns the data received, and sends either Ack or Nak Set parameter Last as: 1=Last=Nak, 0=Ack=More | |
| Last | |
| Sends Ack if 0, else Nak | |
| Return | |
| SetValue | |
| Change Named property to new Value. If "CHANNEL" the ports will be also updated from the fcd | |
| Name | |
| Value | |
| port value as string | |
| Return | |
| Master_Init | |
| Initialise the Master | |
| Return | |
| Master_Start | |
| Output a Master Start sequence | |
| Return | |
| Master_TxByte | |
| Send a data byte | |
| Data | |
| Return | |
| Master_Restart | |
| Output a Master Restart sequence | |
| Return | |
| GetList | |
| returns Named property List as filter string | |
| Name | |
| Return | |