Virtual Serial Ports for PICSimLab: com0com on Windows and tty0tty on Linux

Serial communication is where many first PICSimLab projects get stuck — not because the simulator is broken, but because there is a piece of setup the desktop version cannot do for you. This guide explains what that piece is and how to set it up on Windows and Linux. It applies after you have installed PICSimLab itself (see the Windows and Ubuntu & Debian guides, and the platform pages under Download).

Why a virtual port pair is needed

On a real development board, the microcontroller’s UART is wired to a USB-to-serial chip, and your PC sees a COM port (Windows) or a /dev/ttyUSB* device (Linux). PICSimLab’s simulated board has a serial port too — but it exists only inside the simulation. For another program (a serial terminal, the Arduino IDE serial monitor, your own script) to talk to it, the simulated port must be connected to something your operating system can open.

The official PICSimLab documentation states the prerequisite plainly: desktop serial simulation needs a NULL-MODEM virtual serial port pair. A pair is two virtual ports wired back-to-back, like a null-modem cable: PICSimLab opens one end, your terminal program opens the other, and bytes written to one appear at the other. The port format used is 8N1 — 8 data bits, no parity, 1 stop bit — with the baud rate set to whatever your firmware expects.

Note that this is a desktop-version topic: the official online version of PICSimLab has no serial communication support (only the IO Vterm virtual terminal), per the official documentation.

Windows: com0com

  1. Install com0com, the free open-source null-modem emulator for Windows named in the official documentation.
  2. Use its setup utility to create a port pair (for example COM10 and COM11). Keep the pair dedicated to PICSimLab so other programs do not grab the ports.
  3. In PICSimLab, configure the board’s serial port to use one end of the pair (for example COM10).
  4. Open the other end (COM11) in your serial terminal or IDE, set the format to 8N1 and the baud rate your firmware uses, and start the simulation. Text your firmware sends now appears in the terminal, and what you type goes to the simulated board.

Linux: tty0tty

  1. Install tty0tty, the virtual null-modem driver named in the official documentation. It creates linked device pairs such as /dev/tnt2 <=> /dev/tnt3.
  2. Note the pair it creates (the exact numbers depend on your system). Make sure your user account is permitted to read and write those device files; if opening a port fails with a permission error, fix the device permissions or group membership for the tty devices first.
  3. In PICSimLab, point the board’s serial port at one end of the pair (for example /dev/tnt2).
  4. Open the other end (for example /dev/tnt3) in your terminal program, set 8N1 and the firmware’s baud rate, and run the simulation.

Quick checks when nothing arrives

  • Crossed ends: PICSimLab and the terminal must be on opposite ends of the pair. Two programs on the same end hear nothing.
  • Settings mismatch: both sides must use 8N1 and the same baud rate as the firmware. Garbled text usually means the baud rate is wrong.
  • Port busy: only one program can open each end. Close other terminals or IDE monitors that may hold the port.
  • Simulation running: the firmware only transmits while the simulation is running and the loaded .hex actually uses the UART.

Related guides

Similar Posts