A Modbus RTU link is normally two boxes and a cable: a master that polls, and a slave — a PLC, a meter, a drive — that answers. When the slave is still on a purchase order, or the master software is still being written, that cable is the bottleneck. A com0com virtual pair removes it. The pair is a null-modem cable inside the driver: whatever one application writes to its end appears at the other end, so a master simulator and a slave simulator running on the same PC can hold a perfectly real RTU conversation — real frames, real function codes, real CRCs — with zero hardware.
This guide builds that setup step by step. If com0com is not installed yet, work through the Windows 11 installation guide first; the pair itself is created in the first-pair guide. Everything below assumes one pair, renamed to COM10 and COM11 so both tools can see it — the rename guide shows the two change commands if your pair still answers to CNCA0 and CNCB0.
How the pieces map onto the wire
In a hardware RTU link the master owns the conversation: it sends a request frame addressed to one slave, and only that slave replies. The virtual version keeps exactly those roles, just with software at both ends:
- Master end (COM10) — a Modbus master simulator, or the master application you are developing. Examples of master simulators include QModMaster (a free, open-source master simulator) and Modbus Poll (a widely used commercial master simulator). Either can drive this setup.
- Slave end (COM11) — a Modbus slave simulator standing in for the PLC or meter, or the slave-side application you are developing. Slave simulators typically let you define a bank of holding registers and coils, then watch the master read and write them.
- The pair — com0com carries the frames between them. To both programs it looks like a short RS232 cable; neither can tell there is no UART involved.
Developers test in both directions with the same bench: simulator-as-master against your slave code when the slave is yours, and simulator-as-slave against your master or SCADA code when the master is yours. The wiring never changes — only which end each program opens.
Step 1: Create and name the pair
Create one pair and rename both ends to ordinary COM numbers, because most Modbus tools list only COM-style names in their port picker:
command> install - -
command> change CNCA0 PortName=COM10
command> change CNCB0 PortName=COM11
Putting the ports in the Ports class (the PortName=COM# form in the rename guide) is the more thorough variant and the one to use if a particular tool still refuses to list the ports. Verify the pair exists before going further: open a terminal on COM11 and type — the characters should appear when a terminal on COM10 is also open. The PuTTY loopback test is a two-minute version of that check.
Step 2: Configure the slave simulator on COM11
Start your slave simulator and attach it to COM11. Three things to set before anything else:
- Slave ID. Give the simulated device an address — 1 is the conventional choice for a bench test. Your master will poll this ID; frames addressed elsewhere are ignored by design.
- Register bank. Define some holding registers and coils and put recognisable values in a few of them (for example 1234 in the first holding register). Known values are what turn ‘something answered’ into ‘the right thing answered’.
- Line settings. Set the port to the settings your real link will use. The common RTU default is 9600 baud, 8 data bits, even parity, 1 stop bit — but what matters is not the default, it is that both ends agree, which is Step 4.
Step 3: Configure the master on COM10
Attach the master simulator (or your master application) to COM10 with the same slave ID. Set up one simple poll first: read two holding registers starting at address 0 from slave 1, repeating every second or so. Resist the urge to build the full poll list now — the first goal is a single clean request/response exchange you can stare at. Most simulators show a transaction log with the raw request frame and the raw response frame side by side; open that view before you start polling.
Step 4: Match the line settings on both ends — exactly
RTU has no negotiation. If the two ends disagree about baud rate, data bits, parity or stop bits, the receiving UART slices the bit stream at the wrong places and produces framing errors, garbage bytes or silence — and because a virtual pair moves bytes perfectly, the mismatch is reproduced faithfully. Check, in both tools:
- Baud rate — identical numbers (9600 and 19200 are the usual bench choices).
- Data bits — 8 for Modbus RTU.
- Parity — even is the classic RTU default; none with 2 stop bits is the other common variant. Pick one, use it at both ends.
- Stop bits — 1 with parity, 2 without, per the convention above.
One virtual-pair subtlety: by default com0com ignores the baud rate entirely and moves data as fast as it can — the official ReadMe puts it plainly, with emulation off ‘data is always transferred at the same speed’. For plain request/response testing that is a gift (everything is instant). For timing-sensitive tests it is a lie you need to switch off, which is the next step.
Step 5: Turn on baud-rate emulation when timing matters
RTU delimits frames by silence: a gap of at least 3.5 character times on the line marks the end of a frame. Real slaves also take real time to turn a request around, and some master software is quietly tuned around those delays. At unlimited virtual speed, frames arrive back-to-back with effectively no gap, and turnaround takes microseconds — code that misbehaves at real line speed can look flawless, and code with marginal inter-frame timing can fail in ways it never would on copper. When your test is about timing — frame gaps, timeout tuning, turnaround delays — enable baud-rate emulation on the sending port:
command> change CNCA0 EmuBR=yes
EmuBR applies per direction, so set it on the other end as well if both directions matter (change CNCB0 EmuBR=yes). The SetupG guide covers the same option in the GUI. Leave it off for functional testing: watching a 200-register poll crawl at an emulated 9600 baud is nobody’s idea of progress.
Step 6: Watch the traffic and read the exchange
With polling running, the transaction log should show the pattern of a healthy link: request frame out, matching response frame back, CRC accepted, values updating. Things worth practising while the bench is free: change a register value in the slave and watch the master display follow; force an exception by polling an address the slave does not implement and confirm your master handles the exception response instead of hanging; stop the slave simulator mid-poll and watch how your master times out and retries. If characters seem to stick, arrive late, or a program freezes at startup, that behaviour has its own explanation — see com0com hangs and leftover characters before blaming your Modbus code.
What this bench proves — and what it does not
This setup proves protocol behaviour: addressing, function codes, register mapping, exception handling, timeout logic. It does not prove electrical behaviour — there is no RS485 bus here, no termination, no biasing, no multi-drop loading, and no real device firmware with its own timing quirks. Treat the virtual link as the rehearsal, not the performance: final commissioning still happens against the real slave on a real bus. Within those limits, it is the fastest Modbus iteration loop available — edit code, restart one program, poll again.
Going further
Two natural next steps once the bench works. Going physical: when you are ready to put a real PLC or meter on the bench, the same master setup talks to it through a USB-to-RS485 converter — our sponsored link lists current options: USB-to-RS485 converters on Amazon (sponsored). Learning Modbus properly: if frame formats, function codes and RTU timing still feel like folklore, a structured course beats forum archaeology — see the Modbus and PLC programming courses collected behind our sponsored link: Modbus courses on Udemy (sponsored). Everything above the links in this section, as ever on this site, was free.
