Jump to content

Component: One Wire (Comms: Interface): Difference between revisions

From Flowcode Help
m Text replacement - "width="10%" align="center" style="background-color:#D8C9D8;"" to "width="10%" align="center" class="mtx-class-macrohead""
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead""
Line 130: Line 130:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''BusReset'''
| width="90%" class="mtx-class-macrohead" | '''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 
| 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 
Line 144: Line 144:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetDeviceCount'''
| width="90%" class="mtx-class-macrohead" | '''GetDeviceCount'''
|-
|-
| colspan="2" | Returns the number of devices found by the last ScanBus operation. 
| colspan="2" | Returns the number of devices found by the last ScanBus operation. 
Line 158: Line 158:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetIDByte'''
| width="90%" class="mtx-class-macrohead" | '''GetIDByte'''
|-
|-
| colspan="2" | Returns byte ectet of the 64-Bit lasered ROM code, 255 on error 
| colspan="2" | Returns byte ectet of the 64-Bit lasered ROM code, 255 on error 
Line 182: Line 182:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
|-
| colspan="2" | Sets up the 1-Wire output pin ready for communications. 
| colspan="2" | Sets up the 1-Wire output pin ready for communications. 
Line 196: Line 196:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MatchROM'''
| width="90%" class="mtx-class-macrohead" | '''MatchROM'''
|-
|-
| colspan="2" | Performs a reset followed by the MatchROM code and then the 8-bit ROM code. 
| colspan="2" | Performs a reset followed by the MatchROM code and then the 8-bit ROM code. 
Line 220: Line 220:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveByte'''
| width="90%" class="mtx-class-macrohead" | '''ReceiveByte'''
|-
|-
| colspan="2" | Receives a byte from the one wire bus a bit at a time 
| colspan="2" | Receives a byte from the one wire bus a bit at a time 
Line 234: Line 234:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ScanBus'''
| width="90%" class="mtx-class-macrohead" | '''ScanBus'''
|-
|-
| colspan="2" | Scans the one wire bus to detect all connected devices. Returns the number of one wire devices found. 
| colspan="2" | Scans the one wire bus to detect all connected devices. Returns the number of one wire devices found. 
Line 248: Line 248:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SkipROM'''
| width="90%" class="mtx-class-macrohead" | '''SkipROM'''
|-
|-
| colspan="2" | Performs a bus reset and the sends the SkipROM command byte 
| colspan="2" | Performs a bus reset and the sends the SkipROM command byte 
Line 262: Line 262:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''TransmitByte'''
| width="90%" class="mtx-class-macrohead" | '''TransmitByte'''
|-
|-
| colspan="2" | Transmit a byte to the one wire bus a bit at a time 
| colspan="2" | Transmit a byte to the one wire bus a bit at a time 
Line 282: Line 282:
|-
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-

Revision as of 14:23, 13 July 2026

Author Matrix Ltd
Version 1.4
Category Comms: Interface


One Wire component

Low level routines for controlling or interacting with a standard one wire interface.

Component Source Code

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

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

Detailed description

No detailed description exists yet for this component

Examples

Device Scanning

To get started with one wire devices it is often useful to collect the unique device serial number for each and every one wire device you are going to connect to your bus.

For example if you have a bus with two temperature sensors connected it is useful to know which sensor is which. Sensor A is monitoring temperature A and sensor B is monitoring temperature B. The only way to tell which is which is to use the serial number.

Here is a program that scans for devices on a one wire bus and outputs the device count and serial numbers using a LCD.

One Wire Device Scan LCD


Here is the same program but this time the device count and serial numbers are output using a UART such as on an Arduino or ESP32.

One Wire Device Scan Serial



To use the examples simply connect a single device to the one wire bus and make a note of the reported serial number.

This serial number can then be entered into the specific one wire component and used to ensure you are communicating with the device you think you are.

A pull up resistor of between 1K and 10K is required between the data I/O pin and VCC.


Further Examples

The One Wire component is a key building block required by a number of other components. Some of which are included below.


Example One Wire comms component being referenced by several specific One Wire device library components.






Macro reference

BusReset

BusReset
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 
- BOOL Return


GetDeviceCount

GetDeviceCount
Returns the number of devices found by the last ScanBus operation. 
- BYTE Return


GetIDByte

GetIDByte
Returns byte ectet of the 64-Bit lasered ROM code, 255 on error 
- BYTE Device
Device ID - Range: 0 - NumDevices - 1 
- BYTE ByteIndex
Index of the data byte. 0=FamilyCode, 1-6=Serial, 7=CRC 
- BYTE Return


Initialise

Initialise
Sets up the 1-Wire output pin ready for communications. 
- VOID Return


MatchROM

MatchROM
Performs a reset followed by the MatchROM code and then the 8-bit ROM code. 
- BYTE FamilyCode
 
- BYTE SerialNumber
 
- VOID Return


ReceiveByte

ReceiveByte
Receives a byte from the one wire bus a bit at a time 
- BYTE Return


ScanBus

ScanBus
Scans the one wire bus to detect all connected devices. Returns the number of one wire devices found. 
- BYTE Return


SkipROM

SkipROM
Performs a bus reset and the sends the SkipROM command byte 
- VOID Return


TransmitByte

TransmitByte
Transmit a byte to the one wire bus a bit at a time 
- BYTE Command
 
- VOID Return


Property reference

Properties
One Wire Pin
I/O pin used to host one wire bus. 
Max Devices
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 
Simulation
API
Lists all the current injector components available on the user's panel