<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Use Cases &#8211; com0com</title>
	<atom:link href="https://com0com.com/use-cases/feed/" rel="self" type="application/rss+xml" />
	<link>https://com0com.com</link>
	<description>Virtual Serial Port Driver for Windows 11/10</description>
	<lastBuildDate>Wed, 21 Oct 2026 09:42:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.3</generator>

<image>
	<url>https://com0com.com/wp-content/uploads/2026/04/favicon-150x150.png</url>
	<title>Use Cases &#8211; com0com</title>
	<link>https://com0com.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Run Legacy Serial Software on Windows 11 With a Virtual COM Port Pair</title>
		<link>https://com0com.com/legacy-serial-software-windows-11/</link>
					<comments>https://com0com.com/legacy-serial-software-windows-11/#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Wed, 21 Oct 2026 07:30:00 +0000</pubDate>
				<category><![CDATA[Use Cases]]></category>
		<guid isPermaLink="false">https://com0com.com/legacy-serial-software-windows-11/</guid>

					<description><![CDATA[Plenty of serial software outlived the serial port. Industrial configuration tools, instrument utilities, data loggers and machine interfaces from the Windows XP era — some from earlier — still run fine on Windows 11, except for one thing: they open COM1 or COM2, and the modern PC has no such hardware. A com0com pair manufactures...]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Plenty of serial software outlived the serial port. Industrial configuration tools, instrument utilities, data loggers and machine interfaces from the Windows XP era — some from earlier — still run fine on Windows 11, except for one thing: they open COM1 or COM2, and the modern PC has no such hardware. A com0com pair manufactures the missing port in software. The legacy program opens one end under a name it understands, and a modern program on the other end plays the role of the device or machine it expects to talk to. This guide covers the pattern, the setting that timing-sensitive old software usually needs, and — plainly — the class of old software this cannot save.</p>



<h2 class="wp-block-heading">The pattern: old app on one end, the present day on the other</h2>



<p class="wp-block-paragraph">Nothing about the setup is legacy-specific at the driver level: create a pair (the <a href="/create-virtual-com-port-pair/">first-pair guide</a>), rename it (below), install the driver with the signing realities of modern Windows in mind (the <a href="/install-com0com-windows-11/">installation guide</a> is the honest version of that story). What differs is the casting. The legacy application takes one end and believes, completely, that it is talking to hardware. The other end is staffed by the modern world: a simulator of the device the old program expects, a gateway program that forwards the conversation to a network service or a present-day database, or simply a terminal window where you play the device by hand while you learn what the old program sends. The general fake-device workflow is developed in <a href="/test-serial-app-without-hardware/">testing a serial app without the hardware</a>; here the &#8216;app under test&#8217; just happens to be older than some of its users.</p>



<h2 class="wp-block-heading">Give the old program a name it understands</h2>



<p class="wp-block-paragraph">Legacy software is usually stricter about port names than modern software: fixed lists offering COM1 through COM4 are common, and a port called CNCA0 is simply not a thing its world contains. Rename the pair&#8217;s legacy end into that world:</p>



<pre class="wp-block-code"><code>command&gt; change CNCA0 PortName=COM2
command&gt; change CNCB0 PortName=COM11</code></pre>



<p class="wp-block-paragraph">Choosing a low number such as COM2 for the legacy end matches what old port pickers offer (renaming to an unused number — check Device Manager for what is taken — and the Ports class form for programs that enumerate devices rather than names, are both in the <a href="/rename-com0com-port/">rename guide</a>). The modern end keeps a high, unambiguous number so nothing else on the system collides with it.</p>



<h2 class="wp-block-heading">Baud-rate emulation: the setting old software usually needs</h2>



<p class="wp-block-paragraph">Old programs were written against physics: at 9600 baud a character takes about a millisecond, replies take as long as they take, and timeouts and pacing delays in the code quietly assume that world. A virtual pair breaks the assumption by default — com0com moves data as fast as it can, because baud-rate emulation is off until you ask for it (the official ReadMe: with emulation off, &#8216;data is always transferred at the same speed&#8217;). To legacy software that can look like a device answering impossibly fast, buffers filling instantly, or handshake timing that never settles. The remedy is one command per direction:</p>



<pre class="wp-block-code"><code>command&gt; change CNCA0 EmuBR=yes
command&gt; change CNCB0 EmuBR=yes</code></pre>



<p class="wp-block-paragraph">With EmuBR on, the pair paces traffic at the baud rate the programs set, and old timing assumptions become true again. The companion setting lives next door: if the old program seems to hang at startup or old characters leak into a new session, that is the receive-overrun behaviour explained in <a href="/com0com-hangs-buffer-overrun/">com0com hangs and leftover characters</a>. Between the rename, EmuBR and EmuOverrun, most &#8216;it almost works&#8217; legacy setups become simply &#8216;it works&#8217;.</p>



<h2 class="wp-block-heading">Staffing the other end: who plays the device?</h2>



<p class="wp-block-paragraph">The legacy program is fixed; the partner on the modern end is your choice, and the right choice depends on what the old setup was for. If the device still exists and works, the partner can be a bridge: hub4com (introduced in the <a href="/hub4com-guide/">hub4com guide</a>) can route between a real port and the virtual pair, putting the legacy program and the physical device back in conversation with a modern PC in the middle. If the device is gone, the partner is a simulator — a small script answering the old program&#8217;s polls with plausible data, as in the fake-device workflow — and the old program becomes a viewer for simulated or imported data. And if the goal is migration rather than preservation, the partner can be a logger: record everything the legacy program sends and expects, because that recording is the specification for its replacement. Decide which of the three you are doing before wiring anything; the pair is the same in all of them, but the work is not.</p>



<h2 class="wp-block-heading">The DOS-era case, described honestly</h2>



<p class="wp-block-paragraph">Software from the DOS era is a step further removed: those programs ran in a DOS environment and expected a DOS COM port. The working arrangement today is two layers, not one. An emulator such as DOSBox provides the DOS environment and can map the DOS program&#8217;s COM port through to a serial device on the host — that mapping concept is the emulator&#8217;s documented job: the DOS program believes it owns COM1, and the emulator delivers its traffic to the host-side port you designate. Make that host-side port one end of a com0com pair, and the other end can be your modern partner program, exactly as above. What this guide deliberately does not do is quote emulator configuration lines from memory: the emulator&#8217;s own documentation is the authority for its serial settings, and they differ between emulator variants. The com0com half — pair, name, EmuBR — is the half this site can vouch for, and it is unchanged.</p>



<h2 class="wp-block-heading">The honest limits: what a virtual port cannot do</h2>



<ul class="wp-block-list">
<li><strong>Software that probes real UART hardware will not work.</strong> Some very old programs bypass the operating system and talk to the serial chip&#8217;s hardware registers at its classic I/O addresses. There is no chip behind a virtual port and nothing at those addresses to answer, so such programs fail no matter how the pair is configured. This is a property of how they were written, not a setting you missed.</li>



<li><strong>The program itself must run first.</strong> A virtual port fixes the missing port; it does not fix a program that cannot run on Windows 11 at all. Get the application starting and looking for its port — with compatibility settings or an emulator where needed — and only then does this guide&#8217;s pattern apply.</li>



<li><strong>Timing is approximated, not recreated.</strong> EmuBR paces the data stream at the set baud rate, but interrupt behaviour and the fine timing of physical hardware are not reproduced. Software that merely prefers realistic pacing is served; software that measures hardware timing precisely is not.</li>



<li><strong>Control lines are emulated.</strong> The pair models modem signals in software. A legacy program that reads DSR or CTS state gets the emulated state — usually what it needs — but nothing physical is asserted anywhere, which matters if the far side was supposed to be real hardware rather than a partner program.</li>
</ul>



<p class="wp-block-paragraph">Within those limits, the pattern rescues a surprising amount of working software: if the program runs on Windows 11 and talks through a named COM port, a renamed pair end plus a patient partner program gives it a second life — and the device it once drove can retire, or be simulated, on the other end of the pair. When the setup misbehaves, work the symptoms from the <a href="/com0com-troubleshooting/">troubleshooting hub</a> rather than reinstalling anything: on a system this carefully arranged, the fault is almost always a name, a setting, or a buffer — all three are five-minute fixes once identified.</p>

]]></content:encoded>
					
					<wfw:commentRss>https://com0com.com/legacy-serial-software-windows-11/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>LabVIEW and Virtual COM Ports: Test VISA Code Against a Simulated Instrument</title>
		<link>https://com0com.com/labview-virtual-com-port/</link>
					<comments>https://com0com.com/labview-virtual-com-port/#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Wed, 21 Oct 2026 06:30:00 +0000</pubDate>
				<category><![CDATA[Use Cases]]></category>
		<guid isPermaLink="false">https://com0com.com/labview-virtual-com-port/</guid>

					<description><![CDATA[LabVIEW serial code has the same test problem as every other serial code, with a graphical accent: the VI is finished, the instrument is not available, and a block diagram cannot be debugged against thin air. The fix is to remember what VISA actually opens — a COM port, not an instrument. Give LabVIEW one...]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">LabVIEW serial code has the same test problem as every other serial code, with a graphical accent: the VI is finished, the instrument is not available, and a block diagram cannot be debugged against thin air. The fix is to remember what VISA actually opens — a COM port, not an instrument. Give LabVIEW one end of a com0com virtual pair, put a small simulated instrument on the other end, and your VISA reads and writes run against a partner that answers like the real hardware. This guide wires that up and names the two gotchas that account for nearly all failures.</p>



<h2 class="wp-block-heading">The shape of the setup</h2>



<p class="wp-block-paragraph">Three pieces, in data-flow order: your LabVIEW VI opens a VISA session to one end of the pair (COM11 in this guide). The com0com pair carries the bytes across. A responder program — a few lines in any language — listens on the other end (COM10) and plays the instrument: it receives your VI&#8217;s query and writes back the reply the real instrument would give. Nothing in the VI knows the difference, which is the entire point: the code under test is the production code, port name aside.</p>



<h2 class="wp-block-heading">Step 1: Create the pair and rename it — this step is not optional</h2>



<p class="wp-block-paragraph">Create the pair as in the <a href="/create-virtual-com-port-pair/">first-pair guide</a>, then rename both ends to COM numbers:</p>



<pre class="wp-block-code"><code>command&gt; change CNCA0 PortName=COM10
command&gt; change CNCB0 PortName=COM11</code></pre>



<p class="wp-block-paragraph">In LabVIEW work the rename matters more than anywhere else. VISA finds serial resources by scanning for ports, and a port still carrying its CNCA0 name can be invisible to that scan — the VI&#8217;s VISA resource control simply never offers it. Renaming to a COM number, and for stubborn cases putting the port into the Ports class with the <code>PortName=COM#</code> form, makes the virtual port enumerate exactly like a hardware port. The full reasoning and both forms are in the <a href="/rename-com0com-port/">rename guide</a>, and the symptom is catalogued in <a href="/com0com-port-not-recognized/">port not recognized</a>.</p>



<h2 class="wp-block-heading">Step 2: Check the port in NI MAX before opening LabVIEW</h2>



<p class="wp-block-paragraph">Open NI MAX (Measurement &amp; Automation Explorer) and look under <em>Devices and Interfaces</em> for the serial ports. The renamed virtual port appears there as a standard COM port, indistinguishable in the list from a hardware one — that listing is your proof that the Windows side and the VISA side can both see it. If it is missing, fix that here, not in the block diagram: it is a naming or driver issue (Step 1, or the <a href="/com0com-troubleshooting/">troubleshooting hub</a>), never a LabVIEW issue. While you are in MAX, its test panels give you a terminal-like way to open the port and send a string — useful in the next step to prove the responder before the VI is involved.</p>



<h2 class="wp-block-heading">Step 3: Put a simulated instrument on the other end</h2>



<p class="wp-block-paragraph">The responder&#8217;s contract is small: read a query, write the reply the instrument manual promises. If the instrument answers <code>*IDN?</code> with a manufacturer string, the responder does exactly that; if it streams measurement values after a trigger command, the responder sends a stored sample line. A minimal Python responder of about twenty lines — listening, matching the query, writing the canned reply — is built in the <a href="/python-pyserial-virtual-port/">pySerial virtual port guide</a>; run it on COM10 and it serves any VISA client, LabVIEW included. Prove this layer with NI MAX first: send the query from the test panel, watch the canned reply come back. Only then involve the block diagram, so that a failure afterwards is known to live in the VI.</p>



<h2 class="wp-block-heading">Step 4: Run the VI against the virtual instrument</h2>



<p class="wp-block-paragraph">In the VI, the serial flow is the standard VISA one: <strong>VISA Open</strong> on the resource name for COM11 (an ASRL resource for the port), the serial configuration your instrument expects (baud rate, data bits, parity, termination behaviour), then <strong>VISA Write</strong> for the query and <strong>VISA Read</strong> for the reply, and <strong>VISA Close</strong> at the end. Set the same line settings the responder assumes — as with any serial link, a mismatch produces framing garbage rather than an error message. Develop the parsing, error handling and state machine here, against the responder&#8217;s canned and deliberately misbehaving replies; the block diagram cannot tell that the instrument is a Python script, and your error clusters will light up in exactly the places the real instrument would eventually have provoked.</p>



<h2 class="wp-block-heading">Gotcha first, actually: termination characters</h2>



<p class="wp-block-paragraph">The most common &#8216;it almost works&#8217; in VISA serial work is a read that seems to hang although the responder swears it replied. Serial reads through VISA typically end in one of three ways: the requested byte count arrives, the read times out, or a termination character — conventionally the line feed — is received and ends the read early, which is how the standard serial configuration in LabVIEW is set up by default. If your simulated instrument&#8217;s canned replies do not end with the termination character your VI expects, the read waits for it until the timeout, every time, and the data you do see arrives a timeout late. Match the two: make the responder terminate replies the way the real instrument does (its manual states the terminator), and set the VI&#8217;s termination behaviour to expect exactly that. Half of all &#8216;the virtual port is slow&#8217; reports are this, on virtual and physical ports alike.</p>



<h2 class="wp-block-heading">Gotcha: leftover characters and buffer behaviour</h2>



<p class="wp-block-paragraph">One difference between the pair and a cable will eventually bite a test session: with the driver default, bytes written while the far end is closed are not thrown away — they wait in the buffer and are delivered when the port is next opened. In LabVIEW terms that can look like a stale reply arriving as the answer to a fresh query, or an instrument that &#8216;answers before being asked&#8217;. It is documented com0com behaviour with a documented remedy (enabling receive buffer overrun emulation on the receiving end), and it is explained with its sibling symptom, startup hangs, in <a href="/com0com-hangs-buffer-overrun/">com0com hangs and leftover characters</a>. Knowing it in advance converts a baffling afternoon into a two-minute fix.</p>



<h2 class="wp-block-heading">Structuring the work: driver VI below, tests above</h2>



<p class="wp-block-paragraph">One organisational habit keeps LabVIEW serial projects testable as they grow: keep the VISA session in a small driver VI of your own — open, configure, write-query, read-reply, close — and let the application VIs call it with a port name. Switching between the virtual instrument and the real one then changes one constant at the top level instead of hunting through block diagrams, and the same driver VI serves the bench prototype, the automated test and the deployed system. It also makes the simulated instrument reusable across projects: the responder script plus the pair convention (COM10 device side, COM11 application side, as used throughout this guide) can live in a shared repository that every LabVIEW project on the team points at.</p>



<h2 class="wp-block-heading">What you have proven, and the final step</h2>



<p class="wp-block-paragraph">Against the virtual instrument you have proven the VI: resource handling, queries, parsing, timeouts, error paths. You have not proven the instrument: its real reply timing, its flow-control expectations and its firmware&#8217;s eccentricities are all still its own. So the workflow ends where every honest virtual workflow ends — a final validation session against the real instrument on the real port, which in LabVIEW terms means changing the VISA resource constant and nothing else. If the setup itself is new to you, the general pattern behind this guide is laid out in <a href="/test-serial-app-without-hardware/">testing a serial app without the hardware</a>.</p>

]]></content:encoded>
					
					<wfw:commentRss>https://com0com.com/labview-virtual-com-port/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Virtual COM Ports for Ham Radio: WSJT-X, Loggers and Rig Control at Once</title>
		<link>https://com0com.com/ham-radio-virtual-com-ports/</link>
					<comments>https://com0com.com/ham-radio-virtual-com-ports/#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Wed, 21 Oct 2026 05:30:00 +0000</pubDate>
				<category><![CDATA[Use Cases]]></category>
		<guid isPermaLink="false">https://com0com.com/ham-radio-virtual-com-ports/</guid>

					<description><![CDATA[A modern HF station is a small software crowd standing around one serial port. The transceiver exposes a single CAT (computer-aided transceiver) port, and everything wants it: WSJT-X needs it to read the frequency and key the radio, the logging program needs it to record the band and mode with each QSO, and a rig-control...]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">A modern HF station is a small software crowd standing around one serial port. The transceiver exposes a single CAT (computer-aided transceiver) port, and everything wants it: WSJT-X needs it to read the frequency and key the radio, the logging program needs it to record the band and mode with each QSO, and a rig-control program needs it to drive the radio itself. Serial ports, however, are exclusive — the first program to open the port owns it, and the rest get an error. Virtual COM ports are how the crowd gets organised, and there are two distinct patterns, because there are two distinct problems.</p>



<h2 class="wp-block-heading">First, name your problem: a bridge, or a crowd?</h2>



<p class="wp-block-paragraph">If a program needs to <em>talk to something that speaks CAT over a serial link</em> — an SDR program feeding a rig-control daemon, a bridge application translating between two pieces of software — the problem is a missing cable between two programs. That is the <strong>pair pattern</strong>. If several programs need the <em>same real radio port at the same time</em> — WSJT-X and the logger both watching the one CAT port — the problem is sharing, and that is the <strong>splitter pattern</strong>. Picking the wrong one is the usual reason virtual-port setups feel cursed.</p>



<h2 class="wp-block-heading">Pattern 1: the com0com pair as a software CAT cable</h2>



<p class="wp-block-paragraph">A com0com pair is a null-modem cable between two applications. In station terms: a rig-control bridge — Hamlib&#8217;s rigctld daemon is the classic example of the type, serving rig control to programs that connect to it — or an SDR/control program presents a CAT-speaking serial endpoint on one end of the pair, and the program that expects to talk to a radio (WSJT-X, a logger with rig polling, a remote-control client) opens the other end and cannot tell it is not wired to hardware. The setup is the standard one from the <a href="/create-virtual-com-port-pair/">first-pair guide</a>:</p>



<ol class="wp-block-list">
<li><strong>Create the pair and rename both ends to COM numbers</strong> (for example COM10 and COM11) with the <a href="/rename-com0com-port/">rename procedure</a> — radio software picks ports from lists of COM-style names and will not find CNCA0/CNCB0.</li>



<li><strong>Point the bridge or SDR-side program at one end</strong> (COM10) as its CAT serial port.</li>



<li><strong>Point WSJT-X (or the logger) at the other end</strong> (COM11), configured exactly as if a radio were attached: same baud rate and line settings the bridge expects.</li>



<li><strong>Prove it with frequency.</strong> Change the frequency on the bridge/SDR side; the program on the other end should follow. Then let WSJT-X request a band change and confirm the far side reacts. Both directions across the pair are now demonstrated.</li>
</ol>



<p class="wp-block-paragraph">Two honest notes about this pattern. The pair carries the CAT conversation faithfully, but it adds a software hop: if a program is picky about timing, baud-rate emulation (<code>EmuBR</code>, covered in the <a href="/setupg-guide/">SetupG guide</a>) makes the virtual cable behave at the set speed instead of flat-out. And the pair solves software-to-software links only — the actual radio still connects the way it always did, through its real port or USB lead, to whichever program owns that side.</p>



<h2 class="wp-block-heading">Pattern 2: the splitter, when everyone wants the radio itself</h2>



<p class="wp-block-paragraph">When WSJT-X, the logger and the rig-control program must all watch (and occasionally drive) the radio&#8217;s one real COM port, a pair is the wrong shape — you need a hub. That is hub4com&#8217;s job, and this site covers it in the dedicated guides rather than repeating them here: <a href="/split-serial-port/">Split One Serial Port Between Several Applications</a> explains the pattern and its etiquette — a broadcast of the radio&#8217;s output to every listener is easy, while several programs <em>transmitting</em> commands into one port needs one-writer discipline, because two CAT commands interleaved into one stream are gibberish to the radio. The GPS half of station life works the same way: one receiver feeding mapping, logging and APRS software at once is the <a href="/share-gps-multiple-apps/">GPS sharing recipe</a>, and it is the same hub, the same pattern.</p>



<h2 class="wp-block-heading">Keeping the station tidy: names, notes and updates</h2>



<p class="wp-block-paragraph">Virtual-port setups fail socially before they fail technically: six months after installation nobody remembers which end of which pair feeds which program, and a port list full of identical names is archaeology waiting to happen. Two habits prevent it. Keep the pair ends&#8217; names meaningful — rename pairs so the COM numbers are stable and write the mapping down (a note in the station log: COM10/COM11 = bridge to WSJT-X, hub shares COM1 to COM5/COM6). And expect Windows updates to occasionally disturb the arrangement; drivers and port assignments can need re-checking after a major update, and the symptom catalogue in the <a href="/com0com-troubleshooting/">troubleshooting hub</a> — ports gone, pairs broken — is written for exactly that morning. Five minutes of documentation when it works saves the contest weekend when it does not.</p>



<h2 class="wp-block-heading">And the GPS side: position for APRS and logging</h2>



<p class="wp-block-paragraph">The receiver half of the station deserves one more sentence, because it is the same problem wearing a different hat: one GPS puck produces a position stream that APRS software, the logger and a mapping program may all want at once, and it is a one-way broadcast — the easiest sharing case there is. The <a href="/share-gps-multiple-apps/">GPS sharing recipe</a> builds it with hub4com in three commands and is the pattern to copy. If your logging is the only consumer, a plain pair is enough: GPS-side software on one end, logger on the other. Either way, the principle from the CAT side holds — decide whether you are bridging or sharing first, and the tool choice makes itself.</p>



<h2 class="wp-block-heading">The honest alternatives other hams use</h2>



<p class="wp-block-paragraph">com0com is the free, open-source option, not the only one, and station computers reward honesty about the trade-offs. <strong>VSP Manager</strong>, a dedicated virtual-port tool for station use, is free for licensed amateurs and is the recommendation you will meet most often in contesting circles. <strong>VSPE</strong> (Virtual Serial Ports Emulator) is the other common choice — a broader emulator whose splitter devices many SDR operators prefer. Both are named here so you can compare deliberately; this site documents the com0com route because it is free for everyone, licensed amateur or not, and because its companion hub covers the splitter pattern without extra software. If your station already runs one of the others happily, there is no prize for switching.</p>



<p class="wp-block-paragraph">One expectation to set before you start: none of this makes the radio itself any less singular. There is still exactly one transmitter, and if two programs command it at cross purposes the radio will do something you did not intend — virtual ports organise access to the CAT conversation, they do not arbitrate between operators. The operator is still the arbiter; the software crowd just stops shouting over each other to reach him.</p>



<h2 class="wp-block-heading">Putting it together</h2>



<p class="wp-block-paragraph">A typical settled station uses both patterns at once: a real radio port split by the hub so WSJT-X and the logger can both follow the frequency, and a com0com pair linking the SDR or bridge software into the same ecosystem as if it were a second radio. Everything above that sentence is patience, not money — and if the setup misbehaves, the faults are the usual ones: a program that cannot see CNC names (rename the pair), or a driver-level problem after an update, both covered from the <a href="/com0com-troubleshooting/">troubleshooting hub</a>. One practical footnote: stations that still wire a radio to the PC with a USB-to-serial CAT lead should use a decent adapter — the sponsored link lists current options: <a href="/go/amazon-usb-serial" rel="sponsored nofollow">USB-to-serial adapters on Amazon</a> (sponsored).</p>

]]></content:encoded>
					
					<wfw:commentRss>https://com0com.com/ham-radio-virtual-com-ports/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Test Your Serial Application Without the Hardware: The com0com Workflow</title>
		<link>https://com0com.com/test-serial-app-without-hardware/</link>
					<comments>https://com0com.com/test-serial-app-without-hardware/#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Wed, 21 Oct 2026 04:30:00 +0000</pubDate>
				<category><![CDATA[Use Cases]]></category>
		<guid isPermaLink="false">https://com0com.com/test-serial-app-without-hardware/</guid>

					<description><![CDATA[Serial software has a cruel dependency: it cannot be exercised at all without something on the other end of the cable. So the device becomes the test schedule — development stalls when it is booked by another team, automated tests are impossible, and &#8216;works on my bench&#8217; means one specific unit with one specific firmware....]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Serial software has a cruel dependency: it cannot be exercised at all without something on the other end of the cable. So the device becomes the test schedule — development stalls when it is booked by another team, automated tests are impossible, and &#8216;works on my bench&#8217; means one specific unit with one specific firmware. The way out is to notice that your application cannot see the device; it can only see a COM port. Give it a virtual port with something believable behind it, and the application is testable on any desk, in any CI runner, at 2 a.m. This post lays out that workflow end to end.</p>



<p class="wp-block-paragraph">The foundation is one com0com pair, renamed to COM names: your application opens one end, the fake device lives on the other. Setup is the <a href="/create-virtual-com-port-pair/">first-pair guide</a> plus the <a href="/rename-com0com-port/">rename guide</a>; if you are new to the pair itself, prove it first with the two-terminal <a href="/putty-loopback-test/">PuTTY loopback test</a>.</p>



<h2 class="wp-block-heading">Step 1: Think of the pair as a device socket</h2>



<p class="wp-block-paragraph">Decide which end is which and never swap them mid-project: for example, your application always opens COM11, and the fake device always listens on COM10. Write that convention into the project README. It sounds trivial, but half of all &#8216;the simulator does nothing&#8217; reports are the application and the simulator opening the same end, or a pair of ends that are not partners. Applications that scan for ports may also need the pair in the Ports class so the port enumerates like hardware — the rename guide covers that form.</p>



<h2 class="wp-block-heading">Step 2: Write a stand-in responder</h2>



<p class="wp-block-paragraph">The fake device is a small program with three behaviours, in increasing order of usefulness:</p>



<ol class="wp-block-list">
<li><strong>Echo.</strong> Send back whatever was received. Useless as a device, priceless as a smoke test: it proves the application can open the port, write, and read its own words returning.</li>



<li><strong>Canned replies.</strong> A table from command to response: when the application sends the device&#8217;s &#8216;measure&#8217; command, reply with a realistic measurement string; when it sends &#8216;status&#8217;, reply with the status format from the manual. This is the workhorse mode — the application can now run its full workflow, parsing included.</li>



<li><strong>Scripted misbehaviour.</strong> The same table plus intent: reply slowly, reply with a truncated frame, reply with a checksum error, do not reply at all. Devices in the field do all of these; your error handling should meet them first in the simulator, not in a customer log file.</li>
</ol>



<p class="wp-block-paragraph">The implementation can be any language your team already uses. A Python version with pySerial — one script listening, one table of replies — is walked through line by line in the <a href="/python-pyserial-virtual-port/">pySerial virtual port guide</a>; the responder there is about twenty lines, and that is genuinely all the machinery this step needs.</p>



<h2 class="wp-block-heading">Step 3: Record and replay the real device, once</h2>



<p class="wp-block-paragraph">Canned replies are guesses about what the device says. Recordings are facts. When you do have the hardware for a day, capture real sessions: put a logging tool (or hub4com&#8217;s trace capability, introduced in the <a href="/hub4com-guide/">hub4com guide</a>) between the device and the application, run the important workflows, and save the exchanges. Back at your desk, the stand-in responder stops inventing replies and starts replaying them: match the application&#8217;s request, answer with the recorded response. Record/replay will never cover paths you did not record, and it ages as firmware changes — but for regression testing (&#8216;did my refactor change how we talk to the device?&#8217;) a library of recorded sessions is the most faithful fake there is.</p>



<h2 class="wp-block-heading">Step 4: Put the fake on the team, not on your laptop</h2>



<p class="wp-block-paragraph">The workflow pays compound interest when it stops being a personal trick. Keep the responder and its reply tables in the project repository, versioned with the code. Document the pair convention (Step 1) next to them. New team members then test serial features without booking hardware, reviewers can reproduce serial bug reports exactly, and CI can run the conversation tests on any Windows machine with the com0com driver installed. Failures found against the fake are cheap; the same failures found against the one physical unit, during integration week, are not.</p>



<p class="wp-block-paragraph">Keep the recordings and reply tables tidy as you go: one folder per device, one file per session or command set, named for the workflow rather than the date. A recording called &#8216;startup-handshake&#8217; will be found and reused; one called &#8216;capture-final-2&#8217; will not, and the difference decides whether the library survives its first month.</p>



<h2 class="wp-block-heading">Choose how faithful the fake needs to be</h2>



<p class="wp-block-paragraph">Not every test deserves the full treatment, and overbuilding the fake is its own waste. Three levels cover most projects. <strong>Level one, the echo:</strong> five minutes of work, enough for smoke tests and for proving the application&#8217;s port handling — use it the day the project starts. <strong>Level two, the reply table:</strong> an hour or two with the device manual, enough for feature development and parser work — this is where most teams should live. <strong>Level three, the recording:</strong> a day with the real hardware, capturing sessions for replay, worth it when the device is expensive, remote, shared, or about to be returned to whoever lent it. Climb only as high as the risk justifies: a hobby project stops at level one, a product team that ships against one scarce prototype usually ends at level three, and both are right.</p>



<p class="wp-block-paragraph">Whichever level you choose, write the fake&#8217;s assumptions down where the team can see them — which commands it answers, which it ignores, which replies are recorded fact and which are read from the manual and hoped. The fake is a theory of the device; keeping the theory explicit is what lets the next engineer trust the tests built on it, and update the theory the day the real device disagrees.</p>



<h2 class="wp-block-heading">The honest limits</h2>



<p class="wp-block-paragraph">A virtual pair is a byte pipe with emulated dressing, and a professional workflow names what it does not reproduce:</p>



<ul class="wp-block-list">
<li><strong>Timing is not real.</strong> With baud-rate emulation off (the default), transfers are as fast as the machine can move them; a device that answers in 200 ms is answered here in microseconds. Enable EmuBR on the sending port — <code>change CNCA0 EmuBR=yes</code>, see the <a href="/setupg-guide/">SetupG guide</a> — when inter-frame gaps or pacing matter, and even then treat timing results as approximate.</li>



<li><strong>Modem signals are emulated, not voltages.</strong> com0com models the control lines (DTR/DSR, RTS/CTS, DCD, RI) in software and can emulate their behaviour, but nothing physical is asserted: there is no real CTS pin for a device to hold low, and hardware flow control against a real device cannot be validated here.</li>



<li><strong>Electrical behaviour does not exist.</strong> No RS232 levels, no RS485 bus, no cable length, no noise — except the noise you deliberately inject with the driver&#8217;s EmuNoise option, which corrupts data at a set probability for robustness testing.</li>



<li><strong>You are testing your software, not the firmware.</strong> The fake device behaves the way you believe the device behaves. Every assumption in the reply table is a place the real device can still surprise you.</li>
</ul>



<p class="wp-block-paragraph">The conclusion those limits point to is a division of labour, not a dismissal: develop, debug and regression-test against the fake, continuously and automatically — then run a deliberate final validation against the real device, on the real cable, before release. Teams that skip the fake waste the device; teams that skip the final validation ship the assumptions. The pair makes the first part nearly free, which is exactly why it belongs in the workflow.</p>

]]></content:encoded>
					
					<wfw:commentRss>https://com0com.com/test-serial-app-without-hardware/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PuTTY Loopback Test: Verify a Virtual COM Port Pair in Minutes</title>
		<link>https://com0com.com/putty-loopback-test/</link>
					<comments>https://com0com.com/putty-loopback-test/#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Wed, 21 Oct 2026 03:30:00 +0000</pubDate>
				<category><![CDATA[Use Cases]]></category>
		<guid isPermaLink="false">https://com0com.com/putty-loopback-test/</guid>

					<description><![CDATA[Before you debug an application, debug the plumbing. The loopback test is the serial world&#8217;s oldest sanity check, adapted to a virtual pair: open a terminal on each end of the pair, type in one, and watch the characters arrive in the other. If they do, the driver, the pair and the port names are...]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Before you debug an application, debug the plumbing. The loopback test is the serial world&#8217;s oldest sanity check, adapted to a virtual pair: open a terminal on each end of the pair, type in one, and watch the characters arrive in the other. If they do, the driver, the pair and the port names are all proven good, and whatever problem you actually have lives in an application or its settings. If they do not, you have learned that in two minutes instead of an afternoon. This guide uses PuTTY; Tera Term or any other serial terminal follows the same steps with the same settings.</p>



<p class="wp-block-paragraph">You need one com0com pair — the <a href="/create-virtual-com-port-pair/">first-pair guide</a> creates it — ideally renamed to COM names such as COM10 and COM11 (see the <a href="/rename-com0com-port/">rename guide</a>), because terminals list COM-style names in their port pickers and the CNC names can be awkward to select.</p>



<h2 class="wp-block-heading">Session settings for the first window</h2>



<p class="wp-block-paragraph">Start PuTTY and build the session for the first end of the pair:</p>



<ol class="wp-block-list">
<li><strong>Session category:</strong> set the connection type to <strong>Serial</strong>. In the <em>Serial line</em> field enter the first port, for example <code>COM10</code>. In the <em>Speed</em> field enter <code>9600</code> — the number is nominal on a virtual pair (with baud emulation off, com0com transfers as fast as it can whatever you set), but both windows and later your application should agree on it as a matter of hygiene.</li>



<li><strong>Connection &gt; Serial category:</strong> set <em>Data bits</em> to 8, <em>Stop bits</em> to 1, <em>Parity</em> to None, and <em>Flow control</em> to None. Flow control off is the important one for a first test: a terminal waiting for a hardware handshake signal that a virtual pair is not asserting will look exactly like a dead port.</li>



<li><strong>Terminal category (optional):</strong> tick <em>Local echo</em> if you want to see your own typing in the window you type it in. With local echo off, what you type appears only in the <em>other</em> window — which is actually the cleaner proof, since anything on screen must have crossed the pair.</li>



<li><strong>Click Open.</strong> A blank terminal window with a cursor is success at this stage; an error dialog about opening the port is a finding, and the troubleshooting section below says what it means.</li>
</ol>



<p class="wp-block-paragraph">Save the session under a name like <code>pair-end-a</code> before opening it if you will repeat this test often — you will.</p>



<h2 class="wp-block-heading">The second window and the type-across test</h2>



<p class="wp-block-paragraph">Start a second PuTTY instance and repeat the setup for the other end of the pair (<code>COM11</code> in our example), identical line settings. Now type a sentence in the first window. Every character should appear in the second window. Type in the second window: the characters should appear in the first. That is the whole test, and a full pass means the pair carries data in both directions — the virtual equivalent of plugging a null-modem cable between two ports and watching both sides talk.</p>



<p class="wp-block-paragraph">A useful variation: close one window, type a line into the other, then reopen the closed window&#8217;s session. On a default com0com pair you may find the line you typed waiting for you, because with receive overrun emulation off, characters sent while the far end is closed stay in the buffer instead of being discarded. That is documented driver behaviour, not a fault — <a href="/com0com-hangs-buffer-overrun/">com0com hangs and leftover characters</a> explains it and the setting that makes the pair behave like a real cable here.</p>



<h2 class="wp-block-heading">Testing your own application on the other end</h2>



<p class="wp-block-paragraph">The loopback becomes a development tool the moment one window is replaced by your program. Close the second PuTTY window, start your application configured for COM11, and keep PuTTY on COM10. Now you are the device: whatever your application sends appears in your PuTTY window, and whatever you type in PuTTY is delivered to your application as if a real instrument had sent it. This is the fastest way to answer the two questions that dominate serial debugging — <em>what exactly did my program send?</em> (look at the terminal) and <em>does my program react correctly to this reply?</em> (type the reply by hand). The workflow generalises into a full no-hardware test bench in <a href="/test-serial-app-without-hardware/">testing a serial app without the hardware</a>, and in automated form in the <a href="/python-pyserial-virtual-port/">pySerial testing guide</a>.</p>



<h2 class="wp-block-heading">Testing a physical device or its app through a pair</h2>



<p class="wp-block-paragraph">The same trick extends one step further when a real device enters the picture. A common pattern: the device talks to a vendor application that exposes its data onward, or a data-forwarding tool bridges the physical port to a virtual one — the pair then lets a second program (yours, or a terminal) observe or share the conversation instead of the device being locked to a single application. The hub tool from the same project, hub4com, is built for exactly that bridging and splitting work; the <a href="/hub4com-guide/">hub4com guide</a> explains how it routes a physical port to virtual ends. Even without the hub, simply proving &#8216;device to its own app works, app to pair works&#8217; isolates faults to one side of the boundary at a time.</p>



<h2 class="wp-block-heading">Log the session when the result matters</h2>



<p class="wp-block-paragraph">A loopback test you run once to convince yourself needs no record. A loopback test you run to convince a colleague, a vendor or your future self deserves one, and PuTTY can keep it: its session logging options record everything the terminal receives to a text file. Log the application-testing variant especially — the file shows the exact byte stream your application emitted, timestamps aside, in a form you can attach to a bug report or diff against a later run. When the &#8216;device&#8217; on the other end misbehaves in the field, a logged known-good conversation from the pair is the reference you compare it against. Tera Term offers equivalent logging if that is your terminal; the habit matters more than the tool.</p>



<h2 class="wp-block-heading">What a failed test tells you</h2>



<ul class="wp-block-list">
<li><strong>PuTTY cannot open the port at all.</strong> The port may not exist (the pair was removed, or the driver is not loaded), or another program already has it open — serial ports are exclusive. If the driver itself is in trouble after installation, start from the <a href="/com0com-troubleshooting/">troubleshooting hub</a>.</li>



<li><strong>The port opens but is not listed in the picker.</strong> Usually a naming issue: the pair still carries its CNC names. Rename it, or put it in the Ports class — see <a href="/com0com-port-not-recognized/">port not recognized</a> for the full picture.</li>



<li><strong>Characters appear in one direction only.</strong> Recheck that both windows use the same port settings and that you opened both ends of the <em>same</em> pair — with several pairs on a system, COM10&#8217;s partner is the end it was created with, not the numerically adjacent port.</li>



<li><strong>Garbled characters.</strong> On a virtual pair this points to mismatched line settings between the two ends (speed is cosmetic here, but data bits and parity are not) rather than to a bad cable — there is no cable.</li>



<li><strong>Nothing appears, but no error either, and flow control is on.</strong> Turn flow control off in both windows and retest; a handshake line held in the wrong state silences a port without any error message.</li>
</ul>



<p class="wp-block-paragraph">A passed two-window test is a small result with large value: it converts &#8216;the serial part is broken somehow&#8217; into &#8216;the serial plumbing is proven; the bug is in this application or its configuration&#8217;. Keep the two saved sessions around — on a serial project, you will reach for them weekly.</p>

]]></content:encoded>
					
					<wfw:commentRss>https://com0com.com/putty-loopback-test/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Test Python Serial Code Without Hardware: pySerial + a com0com Pair</title>
		<link>https://com0com.com/python-pyserial-virtual-port/</link>
					<comments>https://com0com.com/python-pyserial-virtual-port/#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Wed, 21 Oct 2026 02:30:00 +0000</pubDate>
				<category><![CDATA[Use Cases]]></category>
		<guid isPermaLink="false">https://com0com.com/python-pyserial-virtual-port/</guid>

					<description><![CDATA[Every Python developer who works with serial devices hits the same wall: the code is ready, the device is not — it is in another lab, on a colleague&#8217;s desk, or still in a shipping box. pySerial does not care whether a port is copper or virtual, and com0com will happily manufacture a port pair...]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Every Python developer who works with serial devices hits the same wall: the code is ready, the device is not — it is in another lab, on a colleague&#8217;s desk, or still in a shipping box. pySerial does not care whether a port is copper or virtual, and com0com will happily manufacture a port pair on the spot. Put the two together and you get a test bench where one Python script plays the device and your real application plays itself, talking over a virtual null-modem cable. This guide builds that bench with two short, runnable scripts.</p>



<p class="wp-block-paragraph">Prerequisites are small: com0com installed (the <a href="/install-com0com-windows-11/">installation guide</a> covers Windows 11 honestly, signing caveats included) and pySerial installed in your environment, which is the usual <code>pip install pyserial</code>. No other libraries are needed.</p>



<h2 class="wp-block-heading">Step 1: Create the pair and give it COM names</h2>



<p class="wp-block-paragraph">Create one pair and rename both ends, as in the <a href="/create-virtual-com-port-pair/">first-pair guide</a>:</p>



<pre class="wp-block-code"><code>command&gt; install - -
command&gt; change CNCA0 PortName=COM10
command&gt; change CNCB0 PortName=COM11</code></pre>



<p class="wp-block-paragraph">The rename is not cosmetic for Python work. In this guide COM10 is the device side and COM11 is the application side — pick any two free numbers, but rename you must, for the reason in the next section.</p>



<h2 class="wp-block-heading">The CNCA0 naming gotcha</h2>



<p class="wp-block-paragraph">Out of the box, a com0com pair is called CNCA0 and CNCB0, and code that opens ports by plain name trips over that in two ways. First, many port-scanning helpers only look for names matching the COM pattern, so the CNC names never even appear as candidates. Second, Windows itself needs the device-path prefix <code>\\.\</code> to open a port whose name is not a classic COM name — the com0com ReadMe documents this for the Windows API, and pySerial is no exception. In Python the working form is a raw string:</p>



<pre class="wp-block-code"><code>import serial

ser = serial.Serial(r&#x27;\\.\CNCA0&#x27;, 9600, timeout=1)</code></pre>



<p class="wp-block-paragraph">That works, but it makes test code carry a Windows-specific spelling everywhere. The cleaner habit is the rename from Step 1: once the ends are called COM10 and COM11, every library, scanner and script treats them like any other serial port. The full story — including putting ports into the Ports class for tools that enumerate devices — is in the <a href="/rename-com0com-port/">rename guide</a>.</p>



<h2 class="wp-block-heading">Step 2: The device simulator script</h2>



<p class="wp-block-paragraph">The simulator is the stand-in for your hardware. The minimal useful shape is a loop that waits for a query and answers it the way the real device would. This one answers any line ending in a newline with a canned temperature reading, and answers the specific query <code>READ?</code> with a fixed value — enough to develop against:</p>



<pre class="wp-block-code"><code>import serial

# Device side of the pair
dev = serial.Serial(&#x27;COM10&#x27;, 9600, timeout=0.5)

print(&#x27;simulator listening on COM10&#x27;)
while True:
    line = dev.readline()
    if not line:
        continue
    query = line.decode(&#x27;ascii&#x27;, errors=&#x27;ignore&#x27;).strip()
    print(&#x27;device received:&#x27;, query)
    if query == &#x27;READ?&#x27;:
        dev.write(b&#x27;23.7\n&#x27;)
    else:
        dev.write(b&#x27;ERR unknown command\n&#x27;)</code></pre>



<p class="wp-block-paragraph">Two details matter. The <code>timeout=0.5</code> makes <code>readline()</code> return periodically even when nothing arrived, so the loop stays responsive and Ctrl+C works. And the simulator prints everything it receives — when a test fails, that printout is how you learn whether your application sent the wrong bytes or the simulator answered them wrongly. The same responder pattern works when the program on the other end is not Python at all &mdash; LabVIEW users get the equivalent walkthrough in our <a href="/labview-virtual-com-port/">LabVIEW virtual COM port</a> guide.</p>



<h2 class="wp-block-heading">Step 3: Your application (or test) script</h2>



<p class="wp-block-paragraph">The other end is your real code, or a thin slice of it while you are still developing:</p>



<pre class="wp-block-code"><code>import serial

# Application side of the pair
app = serial.Serial(&#x27;COM11&#x27;, 9600, timeout=2)

app.write(b&#x27;READ?\n&#x27;)
reply = app.readline()
print(&#x27;app received:&#x27;, reply.decode(&#x27;ascii&#x27;, errors=&#x27;ignore&#x27;).strip())

app.close()</code></pre>



<p class="wp-block-paragraph">Run the simulator in one terminal, the application in another. The application should print <code>app received: 23.7</code>, and the simulator&#8217;s terminal should show it received <code>READ?</code>. That tiny exchange proves the whole chain: pair, names, settings and both programs. From here, growing the simulator is ordinary Python work — answer from a table of canned replies, reply with values read from a file, or add deliberate misbehaviour (answer slowly, answer with garbage, do not answer at all) to see how your application&#8217;s error handling copes.</p>



<h2 class="wp-block-heading">Make both ends agree on settings</h2>



<p class="wp-block-paragraph">One configuration point deserves its own paragraph because it produces the most confusing failures: the two scripts must open their ports with the same line settings. pySerial&#8217;s constructor defaults — 9600 baud, eight data bits, no parity, one stop bit — apply to both scripts above, which is why they work untouched. The moment you pass explicit settings to one <code>Serial()</code> call (a device that runs at 19200, say, or even parity), pass the matching settings to the other, or the bytes will be sliced at the wrong boundaries and arrive as garbage that no amount of debugging the <em>logic</em> will explain. On a virtual pair the baud number does not change the actual transfer speed — with baud-rate emulation off, com0com ignores it — but framing parameters still have to agree for the data to survive the trip in the form you expect.</p>



<p class="wp-block-paragraph">A related growth step: give the simulator memory. A real sensor&#8217;s readings change, so let the simulator keep a variable — start at 23.7, drift it slightly with each <code>READ?</code>, and your application&#8217;s trending and alarm code gets exercised instead of staring at a constant. Add a second command that changes the simulated state (a setpoint, a mode) and the fake becomes a small state machine, which is all most bench devices ever were.</p>



<h2 class="wp-block-heading">Timeouts and blocking reads, honestly</h2>



<p class="wp-block-paragraph">Most beginner confusion with pySerial is timeout confusion, so be precise. <code>timeout=None</code> means reads block forever until the requested data arrives — a hung script with no error is usually a blocking read waiting for bytes that are never coming. A numeric timeout makes reads return whatever arrived in that window, possibly an empty <code>bytes</code> object, which your code must handle rather than treat as a reply. <code>timeout=0</code> is non-blocking: reads return immediately with whatever is in the buffer. None of this is com0com-specific; the virtual pair delivers bytes exactly like a cable, which is precisely why it is a faithful test bench. One pair-specific behaviour is worth knowing: if nothing has the far end open, bytes you write can wait in the buffer and surface at the next connection instead of vanishing as they would on a real cable — the reasons and the EmuOverrun setting that changes it are covered in <a href="/com0com-hangs-buffer-overrun/">com0com hangs and leftover characters</a>.</p>



<h2 class="wp-block-heading">From scripts to a pytest fixture</h2>



<p class="wp-block-paragraph">Once the two-script bench works, the step to automated tests is conceptual rather than technical. The pattern: a pytest fixture starts the simulator — in a thread inside the test process, or as a separate process — on one end of the pair before each test module, hands the test the other end&#8217;s port name, and shuts the simulator down afterwards. Your tests then read like hardware tests (<em>send READ?, assert the reply parses to 23.7</em>) while running in CI on a machine with no serial hardware at all, as long as the com0com driver is installed there. Keep the canned replies data-driven — a small dictionary or file per simulated device — and the same fixture grows from one sensor into a whole product line of fake devices. The broader workflow, including echo responders and record/replay ideas, is in <a href="/test-serial-app-without-hardware/">testing a serial app without the hardware</a>.</p>



<h2 class="wp-block-heading">Limits of the bench</h2>



<p class="wp-block-paragraph">A virtual pair moves bytes; it does not reproduce a real device&#8217;s timing, its flow-control behaviour on physical pins, or its firmware&#8217;s quirks. Baud rate is also notional unless you enable emulation — with EmuBR off (the default) the pair transfers as fast as it can regardless of the 9600 in your code, so throughput and inter-frame timing tests need <code>change CNCA0 EmuBR=yes</code> and the discussion in the <a href="/setupg-guide/">SetupG guide</a>. Use the bench to develop and regression-test your PC-side code; still run a final session against the real device before you ship.</p>

]]></content:encoded>
					
					<wfw:commentRss>https://com0com.com/python-pyserial-virtual-port/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Simulate a Modbus RTU Link With com0com — No Hardware Needed</title>
		<link>https://com0com.com/modbus-rtu-simulation/</link>
					<comments>https://com0com.com/modbus-rtu-simulation/#respond</comments>
		
		<dc:creator><![CDATA[Admin]]></dc:creator>
		<pubDate>Wed, 21 Oct 2026 01:30:00 +0000</pubDate>
				<category><![CDATA[Use Cases]]></category>
		<guid isPermaLink="false">https://com0com.com/modbus-rtu-simulation/</guid>

					<description><![CDATA[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...]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">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.</p>



<p class="wp-block-paragraph">This guide builds that setup step by step. If com0com is not installed yet, work through the <a href="/install-com0com-windows-11/">Windows 11 installation guide</a> first; the pair itself is created in the <a href="/create-virtual-com-port-pair/">first-pair guide</a>. Everything below assumes one pair, renamed to COM10 and COM11 so both tools can see it — the <a href="/rename-com0com-port/">rename guide</a> shows the two <code>change</code> commands if your pair still answers to CNCA0 and CNCB0.</p>



<h2 class="wp-block-heading">How the pieces map onto the wire</h2>



<p class="wp-block-paragraph">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:</p>



<ul class="wp-block-list">
<li><strong>Master end (COM10)</strong> — 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.</li>



<li><strong>Slave end (COM11)</strong> — 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.</li>



<li><strong>The pair</strong> — com0com carries the frames between them. To both programs it looks like a short RS232 cable; neither can tell there is no UART involved.</li>
</ul>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">Step 1: Create and name the pair</h2>



<p class="wp-block-paragraph">Create one pair and rename both ends to ordinary COM numbers, because most Modbus tools list only COM-style names in their port picker:</p>



<pre class="wp-block-code"><code>command&gt; install - -
command&gt; change CNCA0 PortName=COM10
command&gt; change CNCB0 PortName=COM11</code></pre>



<p class="wp-block-paragraph">Putting the ports in the Ports class (the <code>PortName=COM#</code> 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 <a href="/putty-loopback-test/">PuTTY loopback test</a> is a two-minute version of that check.</p>



<h2 class="wp-block-heading">Step 2: Configure the slave simulator on COM11</h2>



<p class="wp-block-paragraph">Start your slave simulator and attach it to COM11. Three things to set before anything else:</p>



<ol class="wp-block-list">
<li><strong>Slave ID.</strong> 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.</li>



<li><strong>Register bank.</strong> 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 &#8216;something answered&#8217; into &#8216;the right thing answered&#8217;.</li>



<li><strong>Line settings.</strong> 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.</li>
</ol>



<h2 class="wp-block-heading">Step 3: Configure the master on COM10</h2>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">Step 4: Match the line settings on both ends — exactly</h2>



<p class="wp-block-paragraph">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:</p>



<ul class="wp-block-list">
<li><strong>Baud rate</strong> — identical numbers (9600 and 19200 are the usual bench choices).</li>



<li><strong>Data bits</strong> — 8 for Modbus RTU.</li>



<li><strong>Parity</strong> — even is the classic RTU default; none with 2 stop bits is the other common variant. Pick one, use it at both ends.</li>



<li><strong>Stop bits</strong> — 1 with parity, 2 without, per the convention above.</li>
</ul>



<p class="wp-block-paragraph">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 &#8216;data is always transferred at the same speed&#8217;. 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.</p>



<h2 class="wp-block-heading">Step 5: Turn on baud-rate emulation when timing matters</h2>



<p class="wp-block-paragraph">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:</p>



<pre class="wp-block-code"><code>command&gt; change CNCA0 EmuBR=yes</code></pre>



<p class="wp-block-paragraph">EmuBR applies per direction, so set it on the other end as well if both directions matter (<code>change CNCB0 EmuBR=yes</code>). The <a href="/setupg-guide/">SetupG guide</a> 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&#8217;s idea of progress.</p>



<h2 class="wp-block-heading">Step 6: Watch the traffic and read the exchange</h2>



<p class="wp-block-paragraph">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 <a href="/com0com-hangs-buffer-overrun/">com0com hangs and leftover characters</a> before blaming your Modbus code.</p>



<h2 class="wp-block-heading">What this bench proves — and what it does not</h2>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">Going further</h2>



<p class="wp-block-paragraph">Two natural next steps once the bench works. <strong>Going physical:</strong> 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: <a href="/go/amazon-rs485" rel="sponsored nofollow">USB-to-RS485 converters on Amazon</a> (sponsored). <strong>Learning Modbus properly:</strong> 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: <a href="/go/udemy" rel="sponsored nofollow">Modbus courses on Udemy</a> (sponsored). Everything above the links in this section, as ever on this site, was free.</p>

]]></content:encoded>
					
					<wfw:commentRss>https://com0com.com/modbus-rtu-simulation/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
