LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simulate a serial port?

Is it possible to simulate a serial port in either LabVIEW or MAX? It would be nice, when developing an application, to be able to create something that looks and acts like a valid serial port.

 

My guess is that this wouldn't work in LabVIEW, since it has to hook in to the operating system at a lower level than the application does. I know MAX can do some other simulated devices, but couldn't find anything on serial ports.

0 Kudos
Message 1 of 7
(7,892 Views)

It's not possible to simulate serial port in LV (at least there is no method that I'm aware of). However, if you search google for "serial port emulator", you'll find a number of applications which do that (in addition, many of them are free, if you're not looking for advanced solutions, just simple port simulation).

0 Kudos
Message 2 of 7
(7,879 Views)

When you say simulate a serial port, do you mean a vi that drops into the place of the serial port calls (VISA or whatever) and gives back "simulated" responses. If so the answer is Yes. How much it provides in the way of responses is dependent on how much time you wish to spend in developing it. I'm currently building a couple of simulated instruments, which will "look" to my program as though it were talking to real instruments and getting back data. The communication to these instruments is a very small percentage of the total program and to test out the logic of the rest without hooking up the actual instruments (which are about 3000 miles/4800km from here) is paramount.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 3 of 7
(7,832 Views)

Could you give any more detail about how to simulate serial in LabVIEW? I also looked in MAX first, hoping for something similar to the simulated DAQ feature... it seems that doesn't exist, but you say that there is a way to have "a vi that drops into place of the serial port calls." That is exactly what I want, how do I do it?

0 Kudos
Message 4 of 7
(7,697 Views)

I think what LVPro was suggesting is that you could write a pair of VIs that would replace the VISA Read and VISA Write functions, with the Read function returning whatever data the real serial device would return. You could place these inside a conditional disable, with the real VISA functions in another case, so that you could switch between testing and real serial communication.

 

Another option is to install a serial emulator such as com0com, and write a separate LabVIEW application that listens on the paired virtual serial port and responds as if it were the real instrument. This was you can test the real serial communication, but you do need to emulate your instrument. I recently did something like this and it worked well. I had to spend some time watching the serial communication through PortMon since I didn't have a manual, but once I determined the fairly simple protocol, I was able to set up a LabVIEW program that acted like the real instrument, allowing me to do testing at my desk.

Message 5 of 7
(7,674 Views)
If it's really an instrument you need to simulate, see if it has an IVI driver. I'm not a big fan of IVI but the built-in simulation mode is one good reason to use it.
Message 6 of 7
(7,657 Views)

nathand: thanks for the link to com()com, it does what I needed

0 Kudos
Message 7 of 7
(7,616 Views)