Skip to content

Figures

Every figure on this site is drawn by a Python module from facts extracted from the code, so it is rebuilt, not redrawn, when the code changes. CI runs kokeb-docs figures --check and fails when a committed figure no longer matches the code. Each figure below lists the files it is drawn from.

Inside the MCP9700

Block diagram of the MCP9700: its function blocks, how they connect and which package pins reach each block.Block diagram of the MCP9700: its function blocks, how they connect and which package pins reach each block.
Inside the MCP9700
Figure description and sources

The MCP9700's function blocks inside its outline. Arrows between blocks carry signals or data in the direction they point (both ways where they have two heads). The package pins stand on the left and right edges with their numbers, each wired to the block it reaches.

Drawn from: docs/hardware.yml; inc/mcp9700.hpp; inc/mcp9700_adc_interface.hpp.

Hardware description: docs/hardware.yml

Drawn from:

MCP9700: Powered from an I/O pin

Schematic of the MCP9700 powered from an i/o pin: the chip with U2 MCU, R1 resistor 200 Ω, C1 capacitor 1 µF; the MCU wires carry the port hooks GpioSet(CtrlPin::Enable), ReadVoltageMv().Schematic of the MCP9700 powered from an i/o pin: the chip with U2 MCU, R1 resistor 200 Ω, C1 capacitor 1 µF; the MCU wires carry the port hooks GpioSet(CtrlPin::Enable), ReadVoltageMv().
MCP9700: Powered from an I/O pin
Figure description and sources

A schematic. The MCU is on the left, each of its pins level with the chip pin it connects to; above each wire is the hook of the driver's port that drives or reads it. Supply pins point up to their supply and decoupling, ground pins down. Pins on the right carry the loads and the pins tied to a supply or ground; a cross marks a pin left open. A dot is a junction; wires that cross without a dot are not connected.

Drawn from: docs/hardware.yml; inc/mcp9700.hpp; inc/mcp9700_adc_interface.hpp.

Hardware description: docs/hardware.yml

Drawn from:

MCP9700: Typical application

Schematic of the MCP9700 typical application: the chip with U2 MCU, C1 capacitor 100 nF; the MCU wires carry the port hooks GpioSet(CtrlPin::Enable), ReadVoltageMv().Schematic of the MCP9700 typical application: the chip with U2 MCU, C1 capacitor 100 nF; the MCU wires carry the port hooks GpioSet(CtrlPin::Enable), ReadVoltageMv().
MCP9700: Typical application
Figure description and sources

A schematic. The MCU is on the left, each of its pins level with the chip pin it connects to; above each wire is the hook of the driver's port that drives or reads it. Supply pins point up to their supply and decoupling, ground pins down. Pins on the right carry the loads and the pins tied to a supply or ground; a cross marks a pin left open. A dot is a junction; wires that cross without a dot are not connected.

Drawn from: docs/hardware.yml; inc/mcp9700.hpp; inc/mcp9700_adc_interface.hpp.

Hardware description: docs/hardware.yml

Drawn from:

MCP9700 package, SOT-23-3

Outline of the MCP9700 in SOT-23-3 drawn to scale from above: body 2.9 x 1.3 x 1.12 mm, 3 pins.Outline of the MCP9700 in SOT-23-3 drawn to scale from above: body 2.9 x 1.3 x 1.12 mm, 3 pins.
MCP9700 package, SOT-23-3
Figure description and sources

The MCP9700 package seen from the top and, when the height is known, from the side, drawn to scale: 2.9 x 1.3 x 1.12 mm. The arrows carry the datasheet's dimensions, the dot marks pin 1 and the pads are numbered counter-clockwise from it, coloured by the pin's electrical type (legend below). Pads sit centred on each side, evenly spaced; the datasheet's land pattern is the reference for a board.

Drawn from: docs/hardware.yml; inc/mcp9700.hpp; inc/mcp9700_adc_interface.hpp.

Hardware description: docs/hardware.yml

Drawn from:

MCP9700 pinout, SOT-23-3

Pinout of the MCP9700 in SOT-23-3, top view: 3 pins, each with its name, its electrical type as a colour and the driver hook that uses it.Pinout of the MCP9700 in SOT-23-3, top view: 3 pins, each with its name, its electrical type as a colour and the driver hook that uses it.
MCP9700 pinout, SOT-23-3
Figure description and sources

The MCP9700 seen from the top, in its SOT-23-3 package. Pin 1 is marked by the dot; the numbers run counter-clockwise from it. Each pad is coloured by the pin's electrical type (legend below). Next to it is the pin's name and, in mono, the hook of the driver's port that drives or reads it; a pin without a hook is not used by the driver.

Drawn from: docs/hardware.yml; inc/mcp9700.hpp; inc/mcp9700_adc_interface.hpp.

Hardware description: docs/hardware.yml

Drawn from:

The layers, one of them yours

Layer diagram: your application calls the MCP9700 core, which sends register reads and writes through the ADC port contract to the port class you write, which drives the chip; the core and the contract are the same on every MCU.Layer diagram: your application calls the MCP9700 core, which sends register reads and writes through the ADC port contract to the port class you write, which drives the chip; the core and the contract are the same on every MCU.
The layers, one of them yours
Figure description and sources

Top to bottom, each arrow is a call. Your application calls one object, whose public calls are listed from the umbrella header in inc/. The core turns each call into transfers (or, for an analog part, conversion requests) and hands them to the port contract (the CRTP base in inc/*_interface.hpp), which forwards them, at compile time, to the hooks of the port class you write; your port moves the bytes on the bus. The notes on the right say which layers stay the same on every MCU and which one you write. A library without a port contract has only the first two layers.

Drawn from: inc/mcp9700.hpp public calls; inc/mcp9700_adc_interface.hpp AdcInterface; figure module docs/diagrams/figures/driver-layers.py.

Figure module: docs/diagrams/figures/driver-layers.py

Drawn from:

One reading, step by step

Flow of one reading: discard dummy conversions, convert and average N samples, check for a clipped ADC (Saturated), check the spread (Unstable), scale to VOUT and convert to a temperature, check the window (OutputLow, OutputHigh) and add the calibration offset. A failed conversion is Bus.Flow of one reading: discard dummy conversions, convert and average N samples, check for a clipped ADC (Saturated), check the spread (Unstable), scale to VOUT and convert to a temperature, check the window (OutputLow, OutputHigh) and add the calibration offset. A failed conversion is Bus.
One reading, step by step
Figure description and sources

Top to bottom, each card is one step of one reading. The driver first discards dummy conversions (an ADC multiplexer's sample capacitor still holds the previous channel), then converts N times with a wait between conversions and none after the last. The next steps look at those conversions together: a conversion within one ADC step of the declared full scale means the ADC clipped, a wide spread means a floating or disturbed line, and only then are the conversions averaged, scaled by the divider and turned into a temperature with the datasheet's transfer function in one integer expression. The window check compares that temperature with the specified range plus the margin; the calibration offset is added last. The red chips on the right are the one error each step can return; the first one that applies is returned, so a conversion that failed is Bus whatever else is wrong.

Drawn from: src/mcp9700.ipp collect(); src/mcp9700.ipp Evaluate(); src/mcp9700.ipp ReadMeasurement(); figure module docs/diagrams/figures/read-pipeline.py.

Figure module: docs/diagrams/figures/read-pipeline.py

Drawn from:

Output voltage against temperature

Chart of VOUT in millivolts against temperature from -50 to +160 degrees Celsius: the MCP9700 family at 500 mV plus 10.0 mV per degree, the MCP9701 family at 400 mV plus 19.5 mV per degree, and a Custom example, each solid over its specified range and dotted over the plausibility margin.Chart of VOUT in millivolts against temperature from -50 to +160 degrees Celsius: the MCP9700 family at 500 mV plus 10.0 mV per degree, the MCP9701 family at 400 mV plus 19.5 mV per degree, and a Custom example, each solid over its specified range and dotted over the plausibility margin.
Output voltage against temperature
Figure description and sources

The horizontal axis is the die temperature, the vertical axis the voltage at VOUT, from Equation 4-1, V = V0 + TC x T. The MCP9700, MCP9700A and MCP9700B share the lower line (500 mV at 0 C, 10.0 mV/C); the MCP9701 and MCP9701A the steeper one (400 mV at 0 C, 19.5 mV/C). The dashed line is a Custom example from the Configuration page. Each line is solid over its specified temperature range and dotted over the plausibility margin the driver adds on each side (range_margin_mc, default 8 C): a reading outside the solid part and its dotted margin is OutputLow or OutputHigh, never a temperature. The dots mark the ends of the specified range and the voltage there.

Drawn from: inc/mcp9700_types.hpp kVariantTable; inc/mcp9700_types.hpp range_margin_mc; tests/docs/configuration.cpp custom-offset; figure module docs/diagrams/figures/transfer-function.py.

Figure module: docs/diagrams/figures/transfer-function.py

Drawn from: