Difference between revisions of "Component: Temperature (DS1822) (Environmental)"
(XML import) |
|||
Line 21: | Line 21: | ||
==Examples== | ==Examples== | ||
− | |||
+ | This example shows how to connect the DS1822 component to the OneWire component and either select a specific device on the bus or scan through the devices on the bus collecting the temperature readings. | ||
+ | |||
+ | The temperature and serial number is output using a UART connection as is onboard a Arduino or ESP32 device. | ||
+ | |||
+ | {{fcfile|Example_DS1822.fcfx|Example DS1822}} | ||
==Downloadable macro reference== | ==Downloadable macro reference== |
Revision as of 14:40, 13 August 2021
Author | MatrixTSL |
Version | 1.0 (Release) |
Category | Environmental |
Contents
Temperature (DS1822) component
A rugged temperature sensor allowing one or more sensors to be addressed and read. Capable of reading temperatures from -55 to +125 degrees C. Requires a One Wire component to perform the bus operations.
Examples
This example shows how to connect the DS1822 component to the OneWire component and either select a specific device on the bus or scan through the devices on the bus collecting the temperature readings.
The temperature and serial number is output using a UART connection as is onboard a Arduino or ESP32 device.
Downloadable macro reference
SampleAllDevices
Performs a temperature conversion on all compatible devices.
The temperature can be read using the ReadTemperature macro.
Brefore calling ReadTemperature you need to use one of the Address macros.
Parameters
- BOOL WaitForCompletion
- 0=Dont Wait, 1=Block and Wait To Complete
Return value
- This call does not return a value
AddressSpecificDevice
Starts a temperature conversion on a specific device using a hex string identifier.
SerialNumber parameter should be 12 characters and contain the 48-bit Serial.
Parameters
- <- STRING SerialNumber
- 48-bit Serial Number e.g. "32DF4A3C1901"
- This parameter may be returned back to the caller
Return value
- This call does not return a value
AddressNextDevice
Scans for the next connected device with a matching family code.
Goes through the device list generated by the ScanBus macro.
Parameters
- This macro has no parameters
Return value
- This call does not return a value
GetSerialString
Gets the Serial String for the current addressed device.
Parameters
- This macro has no parameters
Return value
GetTemperature
Reads the temperature from the last sample on the selected device.
The selected device is set using the AddressNext or AddressSpecific macros.
Parameters
- This macro has no parameters
Return value
SampleAddressedDevice
Performs a temperature conversion on the current addressed device.
Requires one of the Address component macros to be called.
The temperature can be read using the ReadTemperature macro.
Parameters
- BOOL WaitForCompletion
- 0=Dont Wait, 1=Block and Wait To Complete
Return value
- This call does not return a value
Initialise
Configures each matching sensor on the bus with the specified conversion bits.
Parameters
- This macro has no parameters
Return value
- This call does not return a value
Simulation macro reference
This component does not contain any simulation macros
Property reference
One Wire Component
This property is of type Fixed list of ints and can be referenced with the variable name OneWireComp.
Link to the one wire component to host the bus.
Alarm High
This property is of type Unsigned integer and can be referenced with the variable name AlarmHigh.
The high byte of the alarm range
Alarm Low
This property is of type Unsigned integer and can be referenced with the variable name AlarmLow.
The Low byte of the Alarm range
Conversion Bits
This property is of type Fixed list of ints and can be referenced with the variable name ConversionBits.
The number of bits used to perform a temperature sample.
Controls the conversion time and the resolution.
Max Conversion Time
This property is of type Unsigned integer and can be referenced with the variable name MaxConvTime.
The maximum amount of time in milliseconds it will take for a sample to complete.
Temperature Resolution
This property is of type Floating point and can be referenced with the variable name TempRes.
The maximum resolution steps that the temperature can be read in.
Simulate Comms
This property is of type True or false and can be referenced with the variable name SimComms.
No - We use the panel GUI to perform the simulation.
Yes - We use OneWire comms via an API to communicate with real hardware.
Number Sensors
This property is of type Fixed list of ints and can be referenced with the variable name NumSensors.
Sens the number of sensors we can communicate with during simulation
Serial 0
This property is of type Line of text and can be referenced with the variable name Serial0.
Serial number for simulated one wire device