Skip to content

urish/wokwi-ds1820-custom-chip

 
 

Repository files navigation

wokwi-ds1820-custom-chip

chip data sheet

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

Addressing

The device uses OneWire compatible addresses, configurable as described below

OneWire Comms

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)

Implementation details

This chip supports all the functions of the hardware part. Commands are listed below

Reset

Write only. Resets the chip to power on.

Search

The device responds to the search command.

Read

The device replies with its serial no bytes.

Match

The device performs a match to the address sent by the master.

Skip

The device skips to wait for function command.

Alarm Search

TBD: not implemented yet.

Convert

The device stores the temperature that is configured through diagram.json into the scratch pad.

Write Scratchpad

The device writes the Th, Tl and Cfg bytes into the scratch pad.

Read Scratchpad

The device transmits the contents of the scratch pad (9 bytes) to the master

Copy Scratchpad

The device copies the contents of the Th, Tl and Cfg bytes from the scratchpad to its eeprom

Recall

The device copies the contents of the Th, Tl and Cfg bytes from its eeprom to the scratchpad

Read Power Supply

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.

Attributes

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"

Simulator examples

Limitations and ommissions

Power Mode

power mode is currently fixed at parasitic

Convert Temperature in Parasitic mode

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

Read Power Mode

Currently we're ignoring the power mode configuration attribute and assume parasitic mode

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 91.2%
  • C++ 7.9%
  • Other 0.9%