Difference between revisions of "Component: One Wire (DS2482) (Comms: Interface)"
From Flowcode Help
Jump to navigationJump to searchLine 17: | Line 17: | ||
==Component Source Code== | ==Component Source Code== | ||
− | Please click here to download the component source project: [https://www.flowcode.co.uk/ | + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_One_Wire_DS2482_I2C.fcfx FC_Comp_Source_One_Wire_DS2482_I2C.fcfx] |
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_One_Wire_DS2482_I2C.fcfx FC_Comp_Source_One_Wire_DS2482_I2C.fcfx] | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_One_Wire_DS2482_I2C.fcfx FC_Comp_Source_One_Wire_DS2482_I2C.fcfx] | ||
==Detailed description== | ==Detailed description== | ||
+ | |||
+ | |||
Line 32: | Line 34: | ||
==Examples== | ==Examples== | ||
+ | |||
+ | |||
Line 42: | Line 46: | ||
==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;" | '''ReceiveByte''' | ||
+ | |- | ||
+ | | colspan="2" | Receives a byte from the one wire bus a bit at a time | ||
+ | |- | ||
+ | |- | ||
+ | | 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;" | '''TransmitByte''' | ||
+ | |- | ||
+ | | colspan="2" | Transmit a byte to the one wire bus a bit at a time | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Command | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | 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;" | '''SkipROM''' | ||
+ | |- | ||
+ | | colspan="2" | Performs a bus reset and the sends the SkipROM command byte | ||
+ | |- | ||
+ | |- | ||
+ | | 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;" | '''BusReset''' | ||
+ | |- | ||
+ | | colspan="2" | Issue a 'ping' on the bus. If there is at least one sensor on the bus then it will generate a presence pulse. Returns 0 if a presense pulse was detected Returns 1 no device was detected | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL | ||
+ | | 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;" | '''MatchROM''' | ||
+ | |- | ||
+ | | colspan="2" | Performs a reset followed by the MatchROM code and then the 8-bit ROM code. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | FamilyCode | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | SerialNumber | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | 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;" | '''ScanBus''' | ||
+ | |- | ||
+ | | colspan="2" | Scans the one wire bus to detect all connected devices. Returns the number of one wire devices found. | ||
+ | |- | ||
+ | |- | ||
+ | | 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;" | '''GetDeviceCount''' | ||
+ | |- | ||
+ | | colspan="2" | Returns the number of devices found by the last ScanBus operation. | ||
+ | |- | ||
+ | |- | ||
+ | | 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;" | '''GetIDByte''' | ||
+ | |- | ||
+ | | colspan="2" | Returns byte ectet of the 64-Bit lasered ROM code, 255 on error | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Device | ||
+ | |- | ||
+ | | colspan="2" | Device ID - Range: 0 - NumDevices - 1 | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | ByteIndex | ||
+ | |- | ||
+ | | colspan="2" | Index of the data byte. 0=FamilyCode, 1-6=Serial, 7=CRC | ||
+ | |- | ||
+ | | 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;" | '''Initialise''' | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | |- | ||
+ | | 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'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==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-21-icon.png]] | ||
+ | | width="90%" | Max Devices | ||
+ | |- | ||
+ | | colspan="2" | Controls the maximum number of devices that can be detected during a ScanBus. For each additional device we require 8 bytes to store the ROM ID. Default: 8 = 64 Bytes of RAM | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | I2C Properties | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
+ | | width="90%" | Device Address | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections | ||
+ | |- | ||
+ | |- | ||
+ | | 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" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Options | ||
+ | |- | ||
+ | |- | ||
+ | | 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" | [[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" 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%" | Simulate Comms | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |}==Macro reference== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
Revision as of 09:59, 27 January 2023
Author | MatrixTSL |
Version | 1.0 |
Category | Comms: Interface |
Contents
One Wire (DS2482) component
A One Wire master transciever controlled using I2C comms. Useful for microcontroller devices where One Wire communications timings are too tight to do reliably.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_One_Wire_DS2482_I2C.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_One_Wire_DS2482_I2C.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
![]() |
ReceiveByte |
Receives a byte from the one wire bus a bit at a time | |
![]() |
Return |
![]() |
TransmitByte |
Transmit a byte to the one wire bus a bit at a time | |
![]() |
Command |
![]() |
Return |
![]() |
SkipROM |
Performs a bus reset and the sends the SkipROM command byte | |
![]() |
Return |
![]() |
MatchROM |
Performs a reset followed by the MatchROM code and then the 8-bit ROM code. | |
![]() |
FamilyCode |
![]() |
SerialNumber |
![]() |
Return |
![]() |
ScanBus |
Scans the one wire bus to detect all connected devices. Returns the number of one wire devices found. | |
![]() |
Return |
![]() |
GetDeviceCount |
Returns the number of devices found by the last ScanBus operation. | |
![]() |
Return |
![]() |
Initialise |
![]() |
Return |
Property reference
==Macro reference==
![]() |
ReceiveByte |
Receives a byte from the one wire bus a bit at a time | |
![]() |
Return |
![]() |
TransmitByte |
Transmit a byte to the one wire bus a bit at a time | |
![]() |
Command |
![]() |
Return |
![]() |
SkipROM |
Performs a bus reset and the sends the SkipROM command byte | |
![]() |
Return |
![]() |
MatchROM |
Performs a reset followed by the MatchROM code and then the 8-bit ROM code. | |
![]() |
FamilyCode |
![]() |
SerialNumber |
![]() |
Return |
![]() |
ScanBus |
Scans the one wire bus to detect all connected devices. Returns the number of one wire devices found. | |
![]() |
Return |
![]() |
GetDeviceCount |
Returns the number of devices found by the last ScanBus operation. | |
![]() |
Return |
![]() |
Initialise |
![]() |
Return |
Property reference
==Macro reference==
![]() |
ReceiveByte |
Receives a byte from the one wire bus a bit at a time | |
![]() |
Return |
![]() |
TransmitByte |
Transmit a byte to the one wire bus a bit at a time | |
![]() |
Command |
![]() |
Return |
![]() |
SkipROM |
Performs a bus reset and the sends the SkipROM command byte | |
![]() |
Return |
![]() |
MatchROM |
Performs a reset followed by the MatchROM code and then the 8-bit ROM code. | |
![]() |
FamilyCode |
![]() |
SerialNumber |
![]() |
Return |
![]() |
ScanBus |
Scans the one wire bus to detect all connected devices. Returns the number of one wire devices found. | |
![]() |
Return |
![]() |
GetDeviceCount |
Returns the number of devices found by the last ScanBus operation. | |
![]() |
Return |
![]() |
Initialise |
![]() |
Return |
Property reference
==Macro reference==
![]() |
ReceiveByte |
Receives a byte from the one wire bus a bit at a time | |
![]() |
Return |
![]() |
TransmitByte |
Transmit a byte to the one wire bus a bit at a time | |
![]() |
Command |
![]() |
Return |
![]() |
SkipROM |
Performs a bus reset and the sends the SkipROM command byte | |
![]() |
Return |
![]() |
MatchROM |
Performs a reset followed by the MatchROM code and then the 8-bit ROM code. | |
![]() |
FamilyCode |
![]() |
SerialNumber |
![]() |
Return |
![]() |
ScanBus |
Scans the one wire bus to detect all connected devices. Returns the number of one wire devices found. | |
![]() |
Return |
![]() |
GetDeviceCount |
Returns the number of devices found by the last ScanBus operation. | |
![]() |
Return |
![]() |
Initialise |
![]() |
Return |