Devices: interface chips, switches and microcontrollers
Level translators, bus transceivers, isolators, analog switches, microcontrollers, memory and display chips. The parameter tables use the same columns as Devices: passives. Every part has labelled fields with units in the inspector and in All parameters, and the live stimulus of a sensor (light, temperature, field, strain, distance, load) is its main field, first in the list, with a slider range that fits it. A field that shows auto takes a value derived from other parameters until you type one (for example the must-operate voltage of a relay is 0.75 of its coil voltage). Clear it to go back. A variant placed from the library starts with its own typical values, such as 1 kΩ for a Pt1000 or 1.2 V dropout for an AMS1117. A part placed from the library can start with its own values, and a part made with the Part Wizard takes them from its datasheet fields (Part templates reference).
38.1Level translators
| Type | Pins | Variants | Class |
|---|---|---|---|
lvlshift (U) | 1t45: VCCA, GND, A, B, DIR, VCCB. 2t45: 8 pins. txs2: VCCA, VCCB, OE, GND, A1, A2, B1, B2. txs8: 20 pins. | 1t45, 2t45 (direction pin), txs2, txs8 (automatic direction) | approximate |
The 1T45 and 2T45 buffer in the direction set by DIR, each side powered by its own supply. The TXS types have pull-ups on both sides and a pass transistor: whichever side is pulled low pulls the other low, which works for I²C and other open-drain buses.
| Parameter | Key | Unit | Default | Range | Value comes from | What it does |
|---|---|---|---|---|---|---|
| Propagation delay | tpd | s | 5 ns | ≥ 0 | Default, inspector, part file | 1t45, 2t45. |
| Pull-up resistance | r_pu | Ω | 10 kΩ | > 0 | Default, inspector, part file | TXS, each side. |
Key: the name in the circuit file, in a parameter step (R1.r) and for AI agents. Range: a value outside it is refused with E_PARAM. Value comes from: where you can set it. The All parameters tab and agents can set every parameter.
38.2RS-485, CAN and RS-232 transceivers
| Type | Pins | Variants | Class |
|---|---|---|---|
rs485 (U) | RO, nRE, DE, DI, GND, A, B, VCC | none (MAX485 class) | approximate |
| Parameter | Key | Unit | Default | Range | Value comes from | What it does |
|---|---|---|---|---|---|---|
| Differential output | vod | V | 2.0 | > 0 | Default, inspector, part file | |
| Driver output resistance | rout | Ω | 25 | > 0 | Default, inspector, part file | |
| Receiver hysteresis | vth | V | 0.2 | > 0 | Default, inspector, part file | |
| Input resistance | rin | Ω | 12 kΩ | > 0 | Default, inspector, part file | |
| Delay | tpd | s | 50 ns | ≥ 0 | Default, inspector, part file | |
| Fail-safe | failsafe | 0 / 1 | 0 | Default, inspector, part file | An idle bus reads 1. |
Key: the name in the circuit file, in a parameter step (R1.r) and for AI agents. Range: a value outside it is refused with E_PARAM. Value comes from: where you can set it. The All parameters tab and agents can set every parameter.
| Type | Pins | Variants | Class |
|---|---|---|---|
can (U) | 5v: TXD, GND, VCC, RXD, VREF, CANL, CANH, S. 3v3: D, GND, VCC, R, VREF, CANL, CANH, RS. | 5v (TJA1050), 3v3 (SN65HVD230) | approximate |
| Parameter | Key | Unit | Default | Range | Value comes from | What it does |
|---|---|---|---|---|---|---|
| Dominant differential voltage | v_dom | V | 2.0 | > 0 | Default, inspector, part file | |
| Recessive bias resistance | rin | Ω | 25 kΩ | > 0 | Default, inspector, part file | |
| Receiver threshold | vth | V | 0.7 | > 0 | Default, inspector, part file | |
| Delay | tpd | s | 100 ns | ≥ 0 | Default, inspector, part file |
Key: the name in the circuit file, in a parameter step (R1.r) and for AI agents. Range: a value outside it is refused with E_PARAM. Value comes from: where you can set it. The All parameters tab and agents can set every parameter.
| Type | Pins | Variants | Class |
|---|---|---|---|
rs232 (U) | C1+, V+, C1-, C2+, C2-, V-, T2OUT, R2IN, R2OUT, T2IN, T1IN, R1OUT, R1IN, T1OUT, GND, VCC | max232, max3232 | approximate |
V+ and V- come from an internal charge pump, so the pump capacitors aren’t needed in the simulation. Drivers invert and swing to about V+ - 1 V and V- + 1 V.
| Parameter | Key | Unit | Default | Range | Value comes from | What it does |
|---|---|---|---|---|---|---|
| Charge pump voltage | v_pump | V | 0 (2 VCC - 1) | > 0 | Default, inspector, part file | |
| Pump output resistance | rout_pump | Ω | 200 | > 0 | Default, inspector, part file | |
| Receiver input resistance | rin | Ω | 5 kΩ | > 0 | Default, inspector, part file | |
| Receiver threshold | vth | V | 1.3 (± 0.25) | > 0 | Default, inspector, part file |
Key: the name in the circuit file, in a parameter step (R1.r) and for AI agents. Range: a value outside it is refused with E_PARAM. Value comes from: where you can set it. The All parameters tab and agents can set every parameter.
38.3Digital isolators
| Type | Pins | Variants | Class |
|---|---|---|---|
isolator (U) | 2ch: VCC1, INA, INB, GND1, GND2, OUTB, OUTA, VCC2. 4ch: 13 pins with EN2. i2c: VCC1, SDA1, SCL1, GND1, GND2, SCL2, SDA2, VCC2. | 2ch, 4ch, i2c | approximate |
Side 2 follows side 1 after tpd, each side powered by its own supply, with no connection across the barrier. The I²C variant passes both lines both ways as open drain.
| Parameter | Key | Unit | Default | Range | Value comes from | What it does |
|---|---|---|---|---|---|---|
| Delay | tpd | s | 10 ns | ≥ 0 | Default, inspector, part file | |
| Supply current per side | icc | A | 1.5 mA | ≥ 0 | Default, inspector, part file |
Key: the name in the circuit file, in a parameter step (R1.r) and for AI agents. Range: a value outside it is refused with E_PARAM. Value comes from: where you can set it. The All parameters tab and agents can set every parameter.
38.4Analog switches and multiplexers
| Type | Pins | Variants | Class |
|---|---|---|---|
amux (U) | 1x8 (4051): Y0 … Y7, Z, S0 … S2, EN, VDD, VSS, VEE. 1x4, 1x16 (4067), 2x4 (4052), 3x2 (4053), spst_quad (4066), spst, spdt, dual_spdt. | 1x8, 1x4, 1x16, 2x4, 3x2, spst_quad, spst, spdt, dual_spdt | approximate |
The select pins choose the channel joined to the common pin, with break-before-make, an on-resistance that depends on the supply and the signal, capacitances and charge injection. EN is active low unless en_high is set. The family sets the logic thresholds: use cd4000 for the CD405x and 4066.
| Parameter | Key | Unit | Default | Range | Value comes from | What it does |
|---|---|---|---|---|---|---|
| On resistance | ron | Ω | 100 | > 0 | Default, inspector, part file | At ron_vdd. |
| Off resistance | roff | Ω | 1 GΩ | > 0 | Default, inspector, part file | |
| Supply for ron | ron_vdd | V | 5 | > 0 | Default, inspector, part file | ron scales with (ron_vdd / supply)0.8. |
| Ron flatness | ron_flat | 0.3 | ≥ 0 | Default, inspector, part file | Signal dependence. | |
| Switching time | tsw | s | 100 ns | > 0 | Default, inspector, part file | |
| Break-before-make | t_bbm | s | 10 ns | ≥ 0 | Default, inspector, part file | |
| Channel / common capacitance | cs, cd | F | 5 pF, 25 pF | ≥ 0 | Default, inspector, part file | |
| Charge injection | qinj | C | 2 pC | any | Default, inspector, part file | |
| Supply current | icc | A | 1 µA | ≥ 0 | Default, inspector, part file | |
| EN active high | en_high | 0 / 1 | 0 | Default, inspector, part file | ||
| Normally closed | nc | 0 / 1 | 0 | Default, inspector, part file | spst. | |
| Logic family | family | hc | Default, inspector, part file |
Key: the name in the circuit file, in a parameter step (R1.r) and for AI agents. Range: a value outside it is refused with E_PARAM. Value comes from: where you can set it. The All parameters tab and agents can set every parameter.
38.5Microcontrollers
| Type | Pins | Variants | Class |
|---|---|---|---|
mcu (U) | generic: the pins you declare in the code, else the pins named in pinout. atmega328p_tqfp32, attiny85_dip8, stm32f103c8_lqfp48: the package pins. | generic, atmega328p_tqfp32, attiny85_dip8, stm32f103c8_lqfp48 | behavioural, runs your program |
A microcontroller runs the program on its Code tab, in a small language made for pins: GPIO, ADC, DAC, PWM, UART, I²C, SPI and CAN. Each pin or bus you declare is added to the chip. Programming the MCU describes the language, every peripheral and the warnings. Without a program the chip only draws its supply current (10 mA by default), its pins are inputs with clamp diodes, and the generic variant has just VDD and GND. A program that contains fn name( is the old control-block script and runs with a pinmap, as in Programmable control blocks:
"pinmap": { "PA0": "ain0", "PA1": "ain1", "PB0": "out0", "PB1": "out1" }
The parameters are in Parameters. For a chip without a program, gpio sets the mode of each pin: PB0=out1 PB1=pwm:1000:0.25 PA0=in_pu.
38.6Chips and displays
| Type | Pins | Variants | Class |
|---|---|---|---|
chip, display (U, DS) | chip: generic (any pins, named from pinout), eeprom, spi_flash, rtc, i2c_dev, spi_dev, usb_uart. display: hd44780, oled_i2c, oled_spi, tft_spi, epaper. | as listed | every variant works: eeprom, spi_flash, rtc, i2c_dev, spi_dev and usb_uart talk on their bus, generic is an IC box you can open as a subcircuit, and the displays decode what they are sent |
Five chips answer a microcontroller: eeprom (24C02, I²C at 0x50), spi_flash (W25Q, JEDEC id, read, page program, sector erase), rtc (DS1307, I²C at 0x68, BCD time that counts simulated time), and the configurable i2c_dev and spi_dev (below). Memory, flash and RTC chips lists their commands. The displays decode what’s written to them: the HD44780 shows its text on the symbol, the SSD1306 OLED takes I²C or SPI, and the ILI9341 TFT and the e-paper take SPI. A display adds its backlight LED (vf_bl 3.1 V).
USB-UART bridge
The usb_uart variant is a CH340C-class USB-to-UART bridge (SOP-16: GND, TXD, RXD, V3, UD+, UD−, NC1, NC2, CTS, DSR, RI, DCD, DTR, RTS, R232, VCC). Its UART side is real. Its USB side is the Console: what the chip receives on RXD shows there as text, and text you type in the Console goes out on TXD. It’s how a program running on a microcontroller talks to the PC (UART).
- TXD idles high and sends each byte as an 8N1 frame at baud, push-pull from VCC behind 50 Ω with 20 ns edges. The bit times are exact.
- RXD has a 50 kΩ pull-up and thresholds at 0.3 and 0.4 of VCC. A start edge is found as an event and every bit is sampled in the middle. Each byte received becomes Console text: a line feed ends a line, a carriage return is dropped, a partial line is shown after 5 idle byte times or at 120 characters, and other control bytes show as
\xNN. - Send: the send text goes out at send_at once the chip is powered, and again whenever you change it while the circuit runs (a rebuild doesn’t send it twice). Escapes:
\n\r\t\\\xNN. - DTR# and RTS# are outputs, high until dtr or rts is 1, which drives the pin low, as a terminal does when it opens the port. Through 100 nF, DTR resets an Arduino. CTS#, DSR#, RI# and DCD# have 50 kΩ pull-ups. With flow at 1, TXD waits while CTS# is high.
- V3 is the internal 3.3 V regulator output when VCC is 5 V (give it a decoupling capacitor to GND). It only sources: tied to a 3.3 V VCC it carries nothing. Below 2.5 V on VCC the chip sends and receives nothing.
- A stop bit that is low on RXD is a framing error. The sender’s baud rate differs from the chip’s, so the chip warns
W_UARTonce. More than 4096 bytes waiting to be sent warnW_UARTtoo, and the rest are dropped.
| Parameter | Key | Unit | Default | Range | Value comes from | What it does |
|---|---|---|---|---|---|---|
| Supply current | idd | A | 1 mA | ≥ 0 | Default, inspector, part file | |
| Baud rate | baud | baud | 115200 | 300 to 3 000 000 | Default, inspector, part file | 8N1, the same on both sides. |
| Text to send on TXD | send | text | empty | Default, inspector, part file | Sent at send_at, and again whenever it changes. | |
| Send start time | send_at | s | 1 ms | ≥ 0 | File or All parameters | |
| Console line ending | eol | lf | lf, cr, crlf, none | Default, inspector, part file | Added to text typed in the Console input. | |
| DTR asserted | dtr | 0 / 1 | 0 | Live slider | Live toggle. | |
| RTS asserted | rts | 0 / 1 | 0 | Live slider | Live toggle. | |
| Hardware flow control | flow | 0 / 1 | 0 | File or All parameters | TXD waits while CTS# is high. |
Key: the name in the circuit file, in a parameter step (R1.r) and for AI agents. Range: a value outside it is refused with E_PARAM. Value comes from: where you can set it. The All parameters tab and agents can set every parameter.
Live values: rx_bytes, tx_bytes (bytes received and sent) and tx_queued (bytes waiting). The Console input bar and the way to use it are in Console.
I²C and SPI register devices
i2c_dev (VDD, GND, SCL, SDA, INT, ADDR) and spi_dev (VDD, GND, SCK, MOSI, MISO, CS, INT) stand in for any sensor or peripheral that is a block of 8-bit registers: a temperature sensor, an accelerometer, an ADC, a port expander. You give the register map. The chip answers a microcontroller (Memory, flash and RTC chips) or any bus you drive yourself.
- Register map: regs sets the starting values as register=value pairs, hex or decimal:
0x00=0x12 0x01=0x34. Registers not listed start at 0. ro lists read-only registers or ranges (0x00 0x10-0x13): writes to them are acknowledged and ignored. After each byte the register pointer moves to the next register, and it wraps after size registers (256 for I²C, 128 for SPI). - A live reading: with value_reg set, value × scale, rounded, sits in value_bytes (1 or 2) read-only registers from value_reg, most significant byte first, two’s complement when negative. Drag value while the circuit runs, as you would turn up the heat on a sensor. A TMP102 is
value_reg0 andscale16 (0.0625 °C per count). - INT is open drain: it pulls low while value is at or above int_above, and stays released when int_above is empty. Give it a pull-up.
- I²C: the chip answers at addr (7 bit, 0x48 by default), or at addr + 1 with ADDR high, and doesn’t acknowledge any other address. The first data byte of a write sets the register pointer and the next bytes are written from there. A read returns the registers from the pointer, so a program writes the pointer, then reads, as with most sensors. SDA is open drain: SDA and SCL need pull-ups (2.2 kΩ to 10 kΩ).
- SPI: CS is active low, mode 0 by default (cpol, cpha choose modes 1 to 3). The first byte after CS falls is the command: bit 7 set reads, bit 7 clear writes, and bits 6 to 0 are the first register. Then data goes in (write) or comes out (read). MISO sends 0x00 during the command byte and is high impedance while CS is high, so several chips can share it.
- Inputs switch at 0.3 and 0.7 of VDD. The live values show the register pointer and the contents of registers 0x00 to 0x0F and of every listed register.
| Parameter | Key | Unit | Default | Range | Value comes from | What it does |
|---|---|---|---|---|---|---|
| I²C address | addr | 72 (0x48) | 0 to 127 | Default, inspector, part file | i2c_dev. ADDR high adds 1. | |
| Initial register values | regs | text | empty | Default, inspector, part file | register=value pairs. | |
| Read-only registers | ro | text | empty | Default, inspector, part file | Numbers or ranges. | |
| Number of registers | size | 256 / 128 | 1 to 256 | File or All parameters | The pointer wraps here. | |
| Live reading | value | 0 | any | Live slider | Changes in place while running. | |
| Counts per unit | scale | 1 | any | Default, inspector, part file | ||
| Register of the reading | value_reg | none | 0 to 255 | Default, inspector, part file | Empty: no reading. | |
| Reading width | value_bytes | bytes | 2 | 1 or 2 | Default, inspector, part file | |
| INT low at a reading of | int_above | never | any | Default, inspector, part file | ||
| Clock idles high | cpol | 0 / 1 | 0 | Default, inspector, part file | spi_dev. | |
| Sample on the second edge | cpha | 0 / 1 | 0 | Default, inspector, part file | spi_dev. | |
| Supply current | idd | A | 1 mA | ≥ 0 | Default, inspector, part file |
Key: the name in the circuit file, in a parameter step (R1.r) and for AI agents. Range: a value outside it is refused with E_PARAM. Value comes from: where you can set it. The All parameters tab and agents can set every parameter.
- Place a microcontroller, a chip (variant i2c_dev) with value_reg 0 and scale 16, and 4.7 kΩ pull-ups from SDA and SCL to VDD.
- Give the microcontroller this program:
bus T i2c SDA SCL 400kHz, then a loop ofsend T 0x48 0,read T 0x48 2 into raw,print "counts" rawandwait 100ms. - Run, then drag the chip’s Live reading from 25 to 30.
You should seeThe Console shows counts 400 (25 × 16), then 480 after you drag the reading.
Generic IC
The generic variant is an IC box with any pins, named by pinout (name:side, as the Subcircuit / IC). The library now offers one Generic IC tile in its place (the Subcircuit / IC), and a circuit saved with the older box keeps it unchanged. It draws idd from each supply pin (a pin named VCC, VDD, V3, VBAT, AVDD, DVDD, VIN or V+) to the ground pin, and every other pin is a high-impedance input with clamp diodes and a 1 GΩ leak, so the board around it simulates. pullups lists pins that get 50 kΩ to the supply. To give it a behaviour, double-click it, or right-click it and choose Edit subcircuit: it becomes a sheet in place, with one sheet pin on each pin (the wiring stays connected) and one port per pin inside, and it opens in its own ↳ tab. Draw the inside there (Editing a subcircuit).