The DS18B20 Custom Chip simulates the Dallas Semi (Maxim Integrated) One Wire Temperature Sensor of the same name.
The chip has the following pin groups
Name | Description |
---|---|
Vdd |
Power pin |
GND |
ground pin |
DQ |
Data Pin, used as I/O pin |
The device uses OneWire compatible addresses, configurable as described below
The device uses OneWire for comms with the MCU. This custom chip implements a OneWire Slave (only)
A good Arduino library to use on the Arduino side is the OneWire Server Library (TBD)
This chip supports all the functions of the hardware part. Commands are listed below
Write only. Resets the chip to power on.
The device responds to the search command.
The device replies with its serial no bytes.
The device performs a match to the address sent by the master.
The device skips to wait for function command.
TBD: not implemented yet.
The device stores the temperature that is configured through diagram.json
into the scratch pad.
The device writes the Th, Tl and Cfg bytes into the scratch pad.
The device transmits the contents of the scratch pad (9 bytes) to the master
The device copies the contents of the Th, Tl and Cfg bytes from the scratchpad to its eeprom
The device copies the contents of the Th, Tl and Cfg bytes from its eeprom to the scratchpad
The device behavior depends on the value of deviceMode
attribute see below
When configured in Parasitic mode, the chip will pull down the wire when requested to indicate as much. When configured in Vdd mode, the chip will leave the wire floating.
The chip defines a number of attributes that alter the behavior of the operation when used in Wokwi.
Name | Description | Default value |
---|---|---|
ow_debug | controls debug output for base one wire link layer code | "0" |
gen_debug | controls debug output for the chip code | "0" |
deviceMode | controls whether the device behaves as if it was connected to Vdd or uses parasitic voltage | "0" |
deviceID | Specifies the unique 48bit device serial number. This is a string and the value should be limited to precisely 12hex digits Note the device serial's CRC is calculated during init |
"010203040506" |
familyCode | Specifies the device family code. Supported values include 0x10 , 0x22 , 0x28 |
"0x10 " |
power mode is currently fixed at parasitic
In this mode, the master is pulling the bus high for a period of at least 10us during which no activity takes place on the bus. The current implementation completes the conversion immediately and is going back to the init sequence. This is likely not an issue, but it deviates from the spec somewhat
Currently we're ignoring the power mode configuration attribute and assume parasitic mode