Multiple serial ports reading from a shared USB port

I have a program that reads from 4 flow controllers, which send data through RS232 serial ports. Because the computer is located pretty far away, the vendor suggested to use an Edgeport box to convert RS232 to USB, then convert to ethernet port using a SuperBooster converter. The signal travels long distance in ethernet cable to the computer and get converted back to USB, then to the computer. In MAX, I was able to see 8 com ports from the Edgeport box, and I was able to communicate with my flow controllers.
The problem is, it will give me some error message occasionally. Sometime it's a VISA Read error, sometime it's a VISA framing error. Could this be caused by the way the signal is transmitted?
In the program I have four parallel WHILE loops that constantly do READ and WRITE to the 4 flow controllers. Could this be causing the errors? If so, what is the best strategy to design this program?
Thanks

I agree with Mike, you will need an error handling strategy that accounts for these errors.  And retries the communications.  This can be a little tricky, but very doable.  I believe some sort of statemachine approach will work best for this. 
As for your heated probe.  I would make some sort of hardware interlock that will shut it down in case of a coolant failure.  NEVER, EVER trust the computer to be running where safety is concerned, either for personal or hardware.  There are plenty of ICs that can monitor temperature, and have warning, and alarm outputs!  Another option is some sort of watchdog on the communications bus for the coolant control, but I think this is a bit more tricky. 
Paul <--Always Learning!!!
sense and simplicity.
Browse my sample VIs?

Similar Messages

  • How do I stop Serial "VISA Read" from giving me packets instead of available bytes.

    Dear Labvillians,
    Highlight:
    How do I stop serial "VISA read" from giving me packets instead of bytes?
    Background:
    I have a system that serially publishes 14 byte packets on a semi-regular interval.
    At busy times, the producer of these these packets queues the data, effectively producing super-packets in multiples of 14 bytes sometimes as large as 8 packets (112 bytes).
    My protocol handler has been designed to processes bytes, packets or super-packets.
    My application now has multiple devices and the order of message processing is critical to correct functionality.
    My observation is that the VISA read waits until the end of a packet/ super-packet before passing the data to the application code. (See Plot Below)
    My expectation is that VISA read should give me available bytes, and not get too smart for itself and wait for a packet.
    I have observed this on PXI, Embedded PC, cFP and most recently, cRIO
    I have experimented with the cRIO's Scan interface rate, which helps with reducing the packet backlog but doesn't resolve to sub-packet byte read.
    I understand that one solution is to Write FPGA code to handle it and pass the bytes through R/T-FIFO, and there are some great examples on this site.
    Unfortunately this doesn't help with non FPGA devices.
    I have also dabbled in event based serial reads but it is diabolical on vxWorks devices.
    Any Help is appreciated
    iTm - Senior Systems Engineer
    uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT
    Solved!
    Go to Solution.

    Sometimes Talking to yourself is helpful.
    I hope this is a useful Nugget for someone in the future
    iTm - Senior Systems Engineer
    uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT

  • Multiple serial port initialisation problem

    Good Morning All
    I have attached a vi which is giving me a problem that I can't solve, and would appreciate any help.
    The vi is supposed to intialise up to 7 serial ports (only using 5 at the moment), and I'm assuming this is a plausible way to do the initialisation (could be wrong). The serial ports are connected to a pc via a usb hub. The windows XP o/s does recognise the ports according to the device manager.
    The problem is that when the vi is run the following error is reported as shown in the attached word document.
    I have compared the port settings in the device manager properties for each port to the vi settings and they match. What more can I do?
    If somebody has a setup with mutliple serial ports could they try the vi and see if it works for them?
    Thanks and best regards
    Ray
    Solved!
    Go to Solution.
    Attachments:
    ax500 serial port init.vi ‏37 KB
    init error.docx ‏518 KB

    It has nothing to do with multiple serial ports.  It has to do with an invalid setting you are trying to use to configure any one of the serial ports.
    Look at the information in the error message.  Argument 4 of the property node in Configure Serial Port VI is the Stop Bits setting.  I see a coercion dot going into that VI, so that tells me the datatype you are wiring in doesn't quite match.
    You have an array of I32 values, and your values consist of 1's.  Disconnect that array and right click on the terminal of Configure Serial Port VI and pick Create Constant.  You'll see you get a ring data type.  It is a U16.  But if you look at the items in there, you'll see that stop bits 1.0 has a value of 10.  1.5 has a value of 15, 2.0 has a value of 20.  So the value of 1 has no meaning to that property node and you get an error.  You should be wiring in a value of 10.
    Delete that array.  Create an array of the ring constants.  Turn it into a control, and choose the correct ring value for each element of your array.
    You have several other coercion dots.  They may not be causing you problems, but I would consider disconnecting them, creating a constant of the correct datatype, and using that in the array you wire to the Configure subVI.
    I modified your VI and attached it.  See if it works for you.
    Attachments:
    ax500SerialPortInitMOD.vi ‏37 KB

  • How to pass serial number read from a PCB.

    Hi,
    I have a question:
    How do I pass serial number read from a PCB so it will be embedded in Test Report file name for that test sequence. I am running Sequence in “New Execution" - Single Pass.
    My test report file after I run test does not have serial number: “TEST_Rev6_Report[NO_UUT_SERIAL_NUM0][2 32 24 PM][4 26 2013].xml” but my Report Header has serial number present.
    Thank you,
    Henry

    The attached screenshot shows how to set your report options, make sure you have the <TestSocket> and <UUTStatus> macros included in the Report File Path otherwise the serial will not be filled in the filename (Generate path is called a second time from the Single Pass -- Test Socket Entry Point sequence).
    I used the ParallelModel.seq to test it.
    The attached sequence file shows how to set the serial number.
    Search for "Specifying Report File Paths by Expression" in the help for more macros.
    Attachments:
    Sequence File 2.seq ‏5 KB
    Screenshot.png ‏57 KB

  • RxtxSerial library multiple serial ports listener

    Hello All,
    I am using rxtxSerial library (import gnu.io.*; compatible with previousely available from Sun import javax.comm.*;) for my bridge application. Th example provided in the library's web site with nulltest.java employs only one serial port. It is powerful since it is threaded and detects incomming/outgoing streams.
    However, I would like to bridge between servers so multiple ports will be employed. Do you heave any suggestion how to obtain multiple port handling (reading/writing) within the same class. The null test code is presented as follows. Simplest idea is to use arrays, but more details are required.
    // derived from SUN's examples in the javax.comm package
    import java.io.*;
    import java.util.*;
    //import javax.comm.*; // for SUN's serial/parallel port libraries
    import gnu.io.*; // for rxtxSerial library
    public class nulltest implements Runnable, SerialPortEventListener {
       static CommPortIdentifier portId;
       static CommPortIdentifier saveportId;
       static Enumeration        portList;
       InputStream           inputStream;
       SerialPort           serialPort;
       Thread           readThread;
       static String        messageString = "AT";
       static OutputStream      outputStream;
       static boolean        outputBufferEmptyFlag = false;
       public static void main(String[] args) {
          boolean           portFound = false;
          String           defaultPort;
          // determine the name of the serial port on several operating systems
          String osname = System.getProperty("os.name","").toLowerCase();
          if ( osname.startsWith("windows") ) {
             // windows
             defaultPort = "COM5";
          } else if (osname.startsWith("linux")) {
             // linux
            defaultPort = "/dev/ttyS0";
          } else if ( osname.startsWith("mac") ) {
             // mac
             defaultPort = "????";
          } else {
             System.out.println("Sorry, your operating system is not supported");
             return;
          if (args.length > 0) {
             defaultPort = args[0];
          System.out.println("Set default port to "+defaultPort);
              // parse ports and if the default port is found, initialized the reader
          portList = CommPortIdentifier.getPortIdentifiers();
          while (portList.hasMoreElements()) {
             portId = (CommPortIdentifier) portList.nextElement();
             if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                if (portId.getName().equals(defaultPort)) {
                   System.out.println("Found port: "+defaultPort);
                   portFound = true;
                   // init reader thread
                   nulltest reader = new nulltest();
          if (!portFound) {
             System.out.println("port " + defaultPort + " not found.");
       public void initwritetoport() {
          // initwritetoport() assumes that the port has already been opened and
          //    initialized by "public nulltest()"
          try {
             // get the outputstream
             outputStream = serialPort.getOutputStream();
          } catch (IOException e) {}
          try {
             // activate the OUTPUT_BUFFER_EMPTY notifier
             serialPort.notifyOnOutputEmpty(true);
          } catch (Exception e) {
             System.out.println("Error setting event notification");
             System.out.println(e.toString());
             System.exit(-1);
       public void writetoport() {
          System.out.println("Writing \""+messageString+"\" to "+serialPort.getName());
          try {
             // write string to serial port
             outputStream.write(messageString.getBytes());
          } catch (IOException e) {}
       public nulltest() {
          // initalize serial port
          try {
             serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
          } catch (PortInUseException e) {}
          try {
             inputStream = serialPort.getInputStream();
          } catch (IOException e) {}
          try {
             serialPort.addEventListener(this);
          } catch (TooManyListenersException e) {}
          // activate the DATA_AVAILABLE notifier
          serialPort.notifyOnDataAvailable(true);
          try {
             // set port parameters
             serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
                         SerialPort.STOPBITS_1,
                         SerialPort.PARITY_NONE);
          } catch (UnsupportedCommOperationException e) {}
          // start the read thread
          readThread = new Thread(this);
          readThread.start();
       public void run() {
          // first thing in the thread, we initialize the write operation
          initwritetoport();
          try {
             while (true) {
                // write string to port, the serialEvent will read it
                writetoport();
                Thread.sleep(1000);
          } catch (InterruptedException e) {}
       public void serialEvent(SerialPortEvent event) {
          switch (event.getEventType()) {
          case SerialPortEvent.BI:
          case SerialPortEvent.OE:
          case SerialPortEvent.FE:
          case SerialPortEvent.PE:
          case SerialPortEvent.CD:
          case SerialPortEvent.CTS:
          case SerialPortEvent.DSR:
          case SerialPortEvent.RI:
          case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
             break;
          case SerialPortEvent.DATA_AVAILABLE:
             // we get here if data has been received
             byte[] readBuffer = new byte[20];
                   int numBytes = 0;
             try {
                // read data
                while (inputStream.available() > 0) {
                   numBytes = inputStream.read(readBuffer);
                // print data
                String result  = new String(readBuffer);
                System.out.println("Bytes read: "+numBytes+", Read contents: "+result);
             } catch (IOException e) {}
             break;
    }Kujtim
    Edited by: Kujtim on Jul 12, 2009 1:41 PM
    Edited by: Kujtim on Jul 12, 2009 1:43 PM
    Edited by: Kujtim on Jul 13, 2009 1:57 PM

    As an off the wall suggestion, check the usb "power save settings" under "control Panelower Options:Edit Plan Settings:Advanced Settings:USB settings" You want the USB selective suspend setting to be Disabled. Another possible idagnostic tool might be to do  a    Power Efficiency Diagnostics Report  which we have found has occasionally pointed us to usb hanging issues. 
    Using the same type usb-serial adapters doesn't guarantee anything, but I have run into issues where a vendor's driver was implemented incorrectly. It ended up being a wrapper around the FTDI driver, and the wrapper dll wasn't correctly made multi-threaded safe. I browbeat the vendor (I was working at a LARGE corporation, with a prospective LARGE purchase of the devices) into telling me what calls their wrapper made. I then used the FTDI dll directly, not using the "simplified interface" of the vendor's dll. FTDI's dll was thread safe, no more random lockups/BSOD.
    Good Luck, these are incredibly painful!
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • How to allow multiple apps to read from same udp port?

    hello all!
    when i'm trying to open the same udp socket from two different applications, i get error 60 :
    "Address in use".
    i know for sure that it is possible.
    but how i do that with labview ?
    thanks.
    guy.
    Solved!
    Go to Solution.

    I agree with Adnan that this is not really possible with the normal mechanisms. The OS needs to know which application should get the data. An exception are e.g. packet sniffers (such as Wireshark) that intercept the network traffic at a lower level and passively listen in.
    Please provide some details on what "other applications" have done this.
    LabVIEW Champion . Do more with less code and in less time .

  • Multiple serial ports streaming - BSOD/freezes - Hardware or Software problem?

    Hello all,
    I just joined the forums as I'm in dire need of some help with LV. I'm trying to hook up three lasers for an experiment. These are connected to my laptop via seperate RS232 cables with an adapter each to a COM port. I found an LV example that reads in one laser from the manufacturers site (something with .dll files and a C++ library). I'm a beginner with LV and I can't really say I have experience, especially not with custom libraries, so I just tried to make it work somehow. So what I did was basically copy it three times and reconnected some wires and changed the output format. I've added my program to this post; warning, you might get slightly sick by looking at it.
    Anyway, my main problem is; it works, but only for a limited time. After some time the VI will crash or my laptop will BSOD. Now, since my VI isn't very professional and probably has a very bad structure I'm not sure whether this is a problem with the VI or with the RS232 adapters/USB hub. I read some things on faulty RS232 adapters that conflict, but I can also imagine my VI can't deal with three data streams correctly, so I'm not sure where this is coming from.
    I was hoping that if any of you would take a glance at my VI, you could tell me whether it's my VI or not. I'd rather confirm this before I buy three new RS232 adapters.
    P.S. I'm running this on LV 2011 and LV 8.2.1 (my laptop with 2011 only recognises 2 COM ports simultaenously and my other laptop with 8.2.1 all three, but my laptop with 2011 can handle the crashes better)
    Thanks!
    Attachments:
    lv_RF603_Measure_3L_FORCE6.vi ‏120 KB
    library.7z ‏12 KB

    As an off the wall suggestion, check the usb "power save settings" under "control Panelower Options:Edit Plan Settings:Advanced Settings:USB settings" You want the USB selective suspend setting to be Disabled. Another possible idagnostic tool might be to do  a    Power Efficiency Diagnostics Report  which we have found has occasionally pointed us to usb hanging issues. 
    Using the same type usb-serial adapters doesn't guarantee anything, but I have run into issues where a vendor's driver was implemented incorrectly. It ended up being a wrapper around the FTDI driver, and the wrapper dll wasn't correctly made multi-threaded safe. I browbeat the vendor (I was working at a LARGE corporation, with a prospective LARGE purchase of the devices) into telling me what calls their wrapper made. I then used the FTDI dll directly, not using the "simplified interface" of the vendor's dll. FTDI's dll was thread safe, no more random lockups/BSOD.
    Good Luck, these are incredibly painful!
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Problems reading from bound shared variable

    I have a shared variable that is bound to another shared variable.  When I go to read it's value in a VI by wiring the variable to the "value" property of a digital numeric object it displays zero.  When i look at the two shared variable in the variable manager they show the correct values.  Does anyone have a clue what's going on?

    Welcome to the forums!
    Let's narrow down the possibilities here.  Try wiring the shared
    variable directly to a front panel indicator rather than using a
    property node.  Second, the shared variable object includes an
    error out terminal - this is where the variable engine can report any
    errors in obtaining a value from the bound item.  Wire the error
    out to an error handler VI and re-run - you may find that the Shared
    Variable Engine is reporting an error, which would be most helpful in
    determining the problem. 
    If you could let me know the results of the above suggestions, I'll be glad to help further!
    Cheers,
    Matt Pollock
    National Instruments

  • Second serial port for CompactRIO

    I would like to reiterate the question posted here.
    Is it possible to add a second serial port to a CompactRIO chassis?
    Using the FPGA seems like it would not actually be transmitting at RS-232 levels, and using an Ethernet-to-Serial Port converter sounds more promising, but that means having the drivers loaded properly.  Are these the only options, and are they even feasible?  Having a multi serial port module seems like it would be a nice addition to the CompactRIO suite.

    Hi m3nth,
    The link involving using the FPGA and digital modules has been successful in the past with many people and like the tutorial says, a big part with this is converting to voltage using a voltage translator.  With respect to the ENET option, the link below can be used to direct you to the products that we have that you may want to try to implement multiple serial ports.  I've done some research and it appears that there shouldn't be an issue using the converters with a real-time system.  When using the ENET converters, keep in mind that it may cause some more latency in your network as opposed to regular serial transmission.  If you have any more questions, please let me know.  Thanks!
    http://sine.ni.com/nips/cds/view/p/lang/en/nid/10043
    Regards
    Noah R
    Applications Engineering
    National Instruments

  • I want to write and read a hex file from the flash buffer of the microcontroller through the USB serial port

    hello sir,
    I am developing a GUI screen from that i want to write and read a hex file from the flash buffer of the microcontroller through the USB serial port. the driver i am using is FTDID2XX driver.if anyone having examples of loading file through serial port.Please reply me .
    Thanks

    Looks like you should post your request in the LabVIEW forum, this one here preferentially is for LabWindows/CVI...

  • Read from serial-usb converter?

    I have an oxygen detector with serial out
    link to the owners manual with serial info 
    http://www.yokogawa.com/an/download/manual/IM11M10B01-01E.pdf
     and I want to hook it up to my laptop to record the data but i am having trouble as my laptop has no serial port. so i bought this:
    http://www.newegg.com/Product/Product.aspx?Item=N82E16812120901&nm_mc=OTC-Channel&cm_mmc=OTC-channel... 
    How do i read from the usb converter? I can program serial in with the visa on an old pc no problem, but this is giving me some trouble. Any advice would be appreciated thankyou.

    superomario wrote:
    I just ran the driver setup wizard in visa and got this error for the keyspan dongle.
    That might be bad news.  My company actually assigned an engineer to buy every USB to COM converter he could find and test them all with as many apps as possible.  There were many models that were problematic.  You might need to just try another brand (or two (dozen!)).
    Still, check the Device Manger or MAX just in case you get lucky...
    Using LabVIEW: 7.1.1, 8.5.1 & 2013

  • Read data from serial port or TCP port of frontend PC

    Hello Friends,
    I have requirement to read data from device connected to frontend PC which will provide meter reading data.
    Vendor has given me two option.
    1. Device can be connected to seiral port and data transfer will be done through MODBUS RTU protocol.In that case data need to capture from serial port.
    2. Device can be connected to TCP port and Socket program can be provided for data transfer. In that case SAP will act as client and communicate with TCP port.
    There will be multiple workstation with individual meters connected to them.
    I am aware of text file interfacing through front end tools using custom code using VB,JAVA or others.
    Is there any solution availble  to achieve above things using  ABAP other than text file , like direct communication?
    I am using ECC 6.0.

    Hello,
    Socket programming in not available on ABAP, but you may use RFC for the same.
    Use the below links for more details
    [Link 1|http://help.sap.com/printdocu/core/print46c/en/data/pdf/BCFESDE2/BCFESDE2.pdf]
    [Link 2|http://forums.sdn.sap.com/thread.jspa?threadID=1820233]
    Regards,
    Abhishek

  • "Example on reading combined signals from a serial port and separating them for display purposes". I am a beginner in Labview and would appreciate if anyone help with that

    I am working on a wireless vital sign monitor. I have 3 signals; heart rate and temperature. I filter and amplify the signals before converting them into digital form. I then pass them via MAX232 before passing them to RS232 serial cable.
    I am therefore working on a program to receive the combined signal and separate them.
    I have come across serial read and write examples on ni.com but am looking for one where I can actually separate combined signals and display them separately.

    Reading the serial port will give you a string. How you divide the channels depends on how the data was formatted before it was sent over the serial channel.
    If you are designing the instrument, as it seems from your query, then you can set up any form you wish. If your data is always floating point numeric, you could use space or tab characters to separate data words. You could use and XML format. If the instrument is provided by a vendor, contact them for the protocol.
    If tabs are used between words and returns between sets of readings, the resutlant string can be interpretted by the Spreadsheet String to Array function in LV.
    Things to avoid are characters often used by serial communications systems as control characters. Carraige returns are
    often used as command terminators by serial protocols, but may also be used by the port.
    Lynn

  • How can I read the voltage from a serial port

    I am fairly new to LabView and I am having trouble figuring out how to read the DC voltage coming out of an RF Power Supply through a serial port so that I can monitor the voltage every few seconds. In order to do this do I need to purchase a DAQ card or anything like that?

    You would not need a DAQ card to read data over the serial port. You would, however, need a serial port. That may sound sarcastic, but it's not, since many manufacturers are ditching serial ports on computers. If you don't have a serial port then you would need to get something like a USB<->serial adapter or a serial port card that you plug into an expansion slot in your computer.
    Assuming you've got that then you need to find the command set for the RF Power Supply, and write drivers for it so you can send the command to read the voltage, and then read the resposen. I would suggest looking in the Instrument Driver Network to see if a driver for your supply has already been written. 

  • Problem in reading data from serial port continuously- application hangs after sometimes

    I need to read data from two COM port and order of data appearance from COM port is not fixed. 
    I have used small timeout and reading data in while loop continously . If my application is steady for sometime it gets hangs and afterwards it doesnt receive any data again. 
    Then I need to restart my application again to make it work.
    I am attaching VI. Let me know any issue.
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet
    Attachments:
    Scanning.vi ‏39 KB

    billko wrote:
    Ranjeet_Singh wrote:
    I need to read data from two COM port and order of data appearance from COM port is not fixed. 
    I have used small timeout and reading data in while loop continously . If my application is steady for sometime it gets hangs and afterwards it doesnt receive any data again. 
    Then I need to restart my application again to make it work.
    I am attaching VI. Let me know any issue.
    What do you mean, "not fixed?"  If there is no termination character, no start/stop character(s) or even a consistent data length, then how can you really be sure when the data starts and stops?
    I probably misunderstood you though.  Assuming the last case is not ture - there is a certain length to the data - then you should use the bytes at port, like in the otherwise disastrous serial port read example.  In this case, it's NOT disastrous.  You have to make sure that you read all the data that came through.  Right now you have no idea how much data you just read.  Also, if this is streaming data, you might want to break it out into a producer/consumer design pattern.
    Not fixed means order is not fixed, data from any com port can come anytime. lenght is fixed, one com port have 14 byte and other 8 byte fixed..
    Reading data is not an issue for me as it works nice but I have a query that why my application hangs after sometime and stops reading data from COM PORT.
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet

Maybe you are looking for

  • Apple Remote stopped working with Lion on iMac

    My white Apple Remote does not work with Lion on my iMac 2.4ghz Core 2 Duo anymore. I'm sure it was working recently as I was able to control the volume on my RadioShark application.  Now that doesn't work anymore and I can't seem to get the remote t

  • PO - GR based Invoice Verification/ IR Indicator

    Hi, I am facing a problem with the IR indicator in PO. The scenario is a SC is created, a PO is created automatically out of the SC and then a GR confirmation has to be done against the PO. I am using a service product. In the vendor master, I have s

  • How do you use #REGION_STATIC_ID#

    We are doing some calculations using javascript on a tabular form region and I believe I should be using the #REGION_STATIC_ID#. However, I don't understand how to use it. Currently, we are running the page and then viewing the source to determine th

  • PCI-7334 and L298

    Hi there! Hope someone will help me with this one. I am currently working on a project that uses the pci-7334 stepper motor controller. unfortunately, i don't have any power drive with me. but i do have an UMI-7764 connector block and a L298 dual ful

  • Problems doing the jump between queries

    Hi BI experts! I've a problem when I jump from header query to detailed level one. It's difficult to explain, but I try it! In header query I have Vendor, VAT Reg. No, Total Num of invoices and Total Net Amount. The Header report shows (always speaki