Component: One Wire (Comms: Interface)
Author | Matrix Ltd |
Version | 1.4 |
Category | Comms: Interface |
Contents
One Wire component
Low level routines for controlling or interacting with a standard one wire interface.
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.
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.
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.
- DS1822 Temperature Sensor
- DS18B20 Temperature Sensor
- DS18S20 Temperature Sensor
- DS28E07 128 Byte EEPROM
- DS1990 iButton Unique 48-bit ID
Downloadable 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 |
Sets up the 1-Wire output pin ready for communications. | |
![]() |
Return |
![]() |
SetAnalogInput |
Sets the state of a single analogue input. | |
![]() |
Address |
Coil Address | |
![]() |
Value |
Analogue Value range 0 - 65535 | |
![]() |
Return |
![]() |
Initialise |
Starts up the UART to allow communications and initialises the states of the various Modbus Coils, Inputs and Registers to 0. | |
![]() |
Return |
![]() |
Initialise |
Initialises the MIDI component and sets up the UART. | |
![]() |
Return |
![]() |
CommsBaud |
Sets the Baud rate of the alt communications channel | |
![]() |
Baud |
Range: 0-7 : 0=1200 / 7=115200 | |
![]() |
Return |
![]() |
LCDOptions |
Controls some of the LCD options | |
![]() |
Foreground |
Range: 0-1 | |
![]() |
Background |
Range: 0-1 | |
![]() |
Transparent |
Range: 0-1 | |
![]() |
Return |
![]() |
ReadDigitalInput |
Reads a single digital input. | |
![]() |
Channel |
![]() |
Return |
![]() |
PWMDuty |
Sets a single PWM channel duty. Channel = 0 - 5 : 0=EN_AB, 1=A, 2=B, 3=C, 4=D, 5=EN_CD Duty = 0 - 65535 | |
![]() |
Channel |
Range 0-5 | |
![]() |
Duty |
![]() |
Return |
![]() |
LCDCursor |
Sets the cursor position for the MIAC display | |
![]() |
X |
Range: 0-21 | |
![]() |
Y |
Range: 0-4 | |
![]() |
Return |
![]() |
WriteTran |
Allows a single transistor output to be switched on or off. | |
![]() |
Channel |
Range 1-4 | |
![]() |
Value |
0 = Off, 1 = On | |
![]() |
Return |
![]() |
Initialise |
![]() |
Return |
![]() |
LCDClear |
Clears the MIAC display | |
![]() |
Return |