Explainer
Why one RS232 port cannot control three stepper motors
Short answer
RS232 is a point-to-point link with no addressing layer, so one serial port reaches exactly one stepper drive. Three drives need three ports, which any PC carries comfortably, and one code base serves all three once the port is a resource-name input — with reentrant subVIs when the motors must move at the same time. Drives that must share one port need node addressing on a multi-drop link instead.

On this page
One RS232 port controls exactly one stepper drive. The link is point-to-point — one transmitter talks to one receiver, and the serial frame carries data bits only, with no address field — so a command sent down the wire reaches whichever drive is connected and cannot be directed anywhere else. Three drives therefore need three independent serial ports, and a Windows PC carries far more than that. Your existing single-motor code needs one structural change: the port becomes an input instead of a constant. Called three times with three resource names it moves the motors one after another; made reentrant, it moves them at the same time. This article gives the reasoning behind the one-port-per-drive rule, the port mapping on the PC, the code structure for one program serving three drives, and the timing arithmetic that picks between sequential and parallel execution.
Why one RS232 port reaches exactly one drive #
RS232 defines a link between exactly two ends. One transmitter drives one receiver over the data lines, the frame carries start bits, data bits and stop bits but no source or destination field, and the standard provides no wiring that branches one port out to several devices. Wire three drives to one transmit line and all three hear every byte: every drive executes every command, you cannot select a recipient, and the drives' replies collide on the single receive line. That is not control — it is an unaddressed broadcast.
One port per drive is therefore a property of the link, not a limit of the software. Because each drive sits on its own private link, whether all three motors get the same data is decided entirely in the program: writing the same bytes to all three ports produces identical motion, and writing different bytes produces independent motion. The cabling itself shares nothing between ports.
When several drives genuinely must share one wire pair, the physical layer and the protocol change, not the port count. An RS-485 link carries node addressing, which is what lets one pair serve several drives; that pattern is explained in RS-485 stepper drive node addressing: physical layer versus protocol, and stepper motor control from a PLC over Modbus is the same idea applied with an addressed protocol from a PLC master.
Adding three serial ports to the PC #
The software side is not the constraint. The VISA serial layer that LabVIEW uses to open ports documents support for 256 serial ports on any platform, so a Windows machine has room for far more than the three this task needs. The limits that actually bind are physical: free expansion slots, spare USB sockets and cabinet space.
Two additions cover nearly every case. A multi-port PCI or PCIe serial card in a free slot enumerates each channel as its own COM port. One USB-to-serial adapter per drive, or a single multi-port USB unit, does the same through the USB sockets. Either way, the computer that runs this motion code usually lives in the cabinet beside the drives; when you specify that machine-mount station, a fanless industrial mini PC is the usual shape for it.
Map the ports deliberately. A USB adapter moved to a different socket can change which COM number a drive gets, so fix the port numbers in the driver where the operating system offers it, and record which physical drive sits on which COM port next to the machine. Before touching the code, open Device Manager and confirm that three distinct COM ports appear, then talk to each drive on its port once — one short move command per drive is enough to prove the mapping.
One code base, three resource names #
Start from the single-motor program and make one change. Find every place it opens, configures, writes to, reads from or closes the serial port, and replace any hard-coded port constant with a single VISA resource name control wired on the connector pane. For three identical drives the code is otherwise unchanged; the resource name is the only difference between motor one, motor two and motor three. Then pick the execution structure — the timing section below shows which one the machine needs.
| Question | Sequential calls of one subVI | Reentrant subVI, one instance per motor |
|---|---|---|
| How the calls run | one after another, each queueing behind the last | all three instances run concurrently |
| Start stagger | the sum of all three write durations | bounded by the longest single write |
| State between calls | one set of shift registers for the whole queue | per-instance data, kept by preallocated clones |
| Code to maintain | the single-motor VI, unchanged | the same VI, unchanged |
| Fits when | motors move one at a time | motors must start together |
Sequential calls are the simple case: call the same subVI three times with three resource names and the motors execute their moves one after another. Nothing new to design, and it is the right answer whenever nothing on the machine cares about a few tens of milliseconds between motor starts.
Reentrant instances are the case where the motors must move at the same time. In the subVI's execution properties, enable reentrant execution with preallocated clones so each instance keeps its own state between calls — a position count or last-command value lives in that instance's own shift registers, never in a global variable, or the three motors would read and overwrite each other's state. Place the subVI three times on the diagram, wire each instance its own resource name and its own command inputs, and route each error cluster separately so a fault on one port does not stop the other two unless you decide it should.
Ownership is strict: one open session owns a port, so two instances pointed at the same resource name conflict before the first byte moves. The same one-resource-per-link rule repeats across industrial software, where each JSON/XML URL needs its own driver tag in the tree for exactly the reason each serial instance here needs its own resource name.
The timing arithmetic that picks the structure #
The deciding quantity is how long each command occupies the wire, not how fast the PC runs. With 8 data bits, no parity and one stop bit, every byte costs 10 bit-times on the line — start, eight data, stop — so a command of N bytes occupies its port for N × 10 / baud seconds.
Worked example, with assumed inputs: take 9600 bit/s and a 20-byte move command, both of which you read from the drive's own command documentation for the real machine. One bit lasts 1 / 9600 s ≈ 0.1042 ms; one byte lasts 10 × 0.1042 ≈ 1.04 ms; the 20-byte command occupies its port for 20 × 1.04 ≈ 20.8 ms. Sent sequentially through one subVI, three such writes stagger the motor starts by their sum, 3 × 20.8 ≈ 62.5 ms. Launched together on three ports through reentrant instances, the spread between motor starts is the longest single command, about 20.8 ms. If the machine requires three grippers to close within 60 ms of each other, that difference decides the structure on its own. These figures are a calculated example for those two assumptions, not a measured result and not a rating.
One factor sits outside the arithmetic. If the drive stores the move and generates its own step pulses after receiving the command — the stored-move pattern in pulse train versus stored moves at the PLC-to-drive interface — the serial link carries commands only, and the stagger above is the entire timing story; the command format itself is the subject of sending serial move commands to a stepper driver. If instead the PC had to stream individual step pulses over serial, the link speed itself would cap the step rate, and the timing example would no longer apply — drives that work that way say so explicitly in their manuals, so confirm the mode before trusting either number.
Commissioning checks for three independent links #
Run the mapping and the fault behavior down before production:
- Run one instance alone with the other two stopped, and confirm only the intended motor moves. This catches a swapped COM assignment, the most common first-day fault.
- Send a deliberately different command to each port and confirm each motor executes its own command. This proves the three streams are isolated.
- Run all three together and timestamp every write. In the parallel case the spread between motor starts should match the longest single command, not the sum of the three.
- With the axes at rest, disconnect one drive's serial cable, run the program, and confirm the affected instance reports an error in its own error cluster while the other two keep moving. Decide in advance what a lost link means for a moving axis — that response belongs to the machine's risk assessment, not to the serial driver's default behavior.
- Close the program and confirm all three sessions release their ports, then restart it without rebooting the PC. A port left owned by a crashed run blocks the next one.
The decision for each case #
- Motors move one at a time, or tens of milliseconds between starts do not matter: give the PC three ports — a multi-port serial card or one adapter per drive — keep the single-motor code with the resource name as an input, and call it sequentially. No new structure is needed.
- Motors must start together: same three ports, the same single-motor VI made reentrant with preallocated clones, one instance per port, all three writes launched together. Start stagger is then the longest single command rather than the sum of the three.
- One serial port must genuinely serve several drives: that requirement rules RS232 out at the physical layer. Select drives with node addressing on a multi-drop link — the RS-485 and Modbus patterns linked above — and treat the port count as a property of that different design.
- Wiring three drives onto one RS232 port solves none of this: every drive executes every command and the replies collide. The port count is three, the code base is one, and the resource name does the rest.
Questions asked
Can I share one RS232 port between three drives by writing to them one at a time?
No. Taking turns does not add addressing: the serial frame carries no destination field, so every attached drive executes every byte no matter when it was sent, and the drives' replies collide on the single receive line. Time-sharing only works on a link with built-in node addressing, which means a different physical layer and drive family, not a software trick.
Will each drive keep its COM port number after a re-plug or a reboot?
Not by itself. A USB adapter moved to another socket can take a new number, and a multi-port card can renumber after a driver update, so pin the assignments in the port driver where that option exists and keep the written mapping beside the machine. After any change, open the port list and confirm the same three numbers attach to the same three drives before running moves.
Do all three drives have to be identical models?
The one-code-base approach assumes all three drives speak the same command language, which three identical models guarantee. If one drive differs — another firmware generation or another command set — keep the same structure and give that instance its own command-building code; the resource name input stays, and only the bytes placed on the wire change.
How do I tell a serial-link fault from a mechanically stalled motor?
A lost or swapped link is a logic fault: the port reports an error or the motor silently misses commands, with no excess current and no heat. A stalled motor is the opposite: commands arrive correctly, the drive pushes its set current, and the motor heats without moving. Check the error cluster and the drive's current setting first, then the motor temperature, before blaming the wire.


