An error about reading serial port

Hi,
  I have sent 5 bytes(for example: "0","2","F","1","/n") to serial port and used VISA Read. But I only can read 0.  The right result is in the second line of the read string window, The first line is void. Generally speaking, "02F1" should in the first line,then I can read them correctly. The following picture is the result.
  Thank you!
帖子被hengfo在09-17-2007 03:57 AM时编辑过了
Attachments:
read string.JPG ‏6 KB

Hello,
you should add a flat sequence with some extra e.g. 50ms delays between the visa writes and reads, that helped us a lot.
You should also specify a large enough buffer. And don't forget to send the terminating CR and LF.

Similar Messages

  • Read Serial port @100 us

    Hi guys,
    I'd like to know if Labview can read serial port @ 100 microseconds?
    Is it necessary any specific HW for  that? What HW can I use to read at that rate?
    Regards
    Kito

    Take 5-10 minutes and explain your problem much better. Like this. I have an instrument xyz. This instrument use a ZZZ communication protocol, over a YYY link. In my Labview program I want to achieve this XXX. This is what I have done so far.
    Remember good questions draw good answers.
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • How to read serial port only when new data has been sent to it

    I've written this very simple vi to read the serial port whenever the MKS Helium Detector sends a new value.  The timing of new data is controlled directly from the front panel of the MKS instrument.  I thought it was as simple as looking at the "bytes at port", and reading the port only if the value is not zero.  The problem I'm having is that the read function is occuring whether I want it to or not.  Consequently, the "Scan from String" function is returning an error (0) once in a while, because it's reading the serial port as it's being updated (I think).   Apparently, when the port is in the process of being updated, it is not zero.   Anyway, I'm assuming there is a simple fix, but I'm having no luck finding the Easter egg.  Any help would be, as always, very much appreciated. 
    Attachments:
    MKSRead.vi ‏55 KB

    You can approach your problem in a couple of ways. The way you've got it written now, as soon as the number of bytes is non-zero, you read and convert. This means that when a partial string is there, you conversion is nor correct. One way is to wait until non-zero bytes like you do now, and then in another loop, read until the byte count is equal to zero and then do the conversion. You can also read until the cr\lf is detected and then do the conversion on the string. You can also enable the termination character for the read but then you'll have to increase the number of bytes to read to something other than just the number of bytes first available. If the instrument always returns the same number of bytes, you can use that as a constant for the VISA Read. Then the read will terminate whenever the byte count OR the termination character is detected.
    I modified your VI to show you how you might put it in a loop and what for the CR/LF to be detected. You would want to add a timeout to this so that if the character does not show up, the loop will not run infinitely
    Attachments:
    MKSRead_mod.vi ‏68 KB

  • Not correctly reading serial port data after first cycle

    I set up a VI for serial communication using RS232 with a pressure transducer meter. The pressure readings are in a loop along with a series of calculations in that loop. The readout from the first cycle is correct, but i just see garbage characters on every subsequent cycle. The VI was running fine when the loop was just reading the pressure data and not performing any calculations. What could be the reason for this discrepancy.
    The OS is windows NT and software is Labview 6.1
    Thanks

    Thanks for your response,
    I am using a VISA. The bytes at serial port are fixed, that is for a particular command the response number of bytes is fixed. The read operation in the first cycle (of a loop) is correct but it reads garbage characters for every other cycle. I am using a 9600 baud rate and the meter responds directly in strings, no handshake is used.
    Thanks for the response,
    PS: The computer with the code is not connected to the net, i will need to transfer it to post the code.

  • Error 37 with serial port / no with hyperterminal

    I have added to my Pc a card with two serial port, I can access to them by hyperteminal or by labview but only at port 0 and 1 at the same time or 2 and 3, if not I have an error 37. What can I do?

    Error 37 means that LabVIEW cannot find the appropriate serial device. This indicates that one of the following conditions exists:
    LabVIEW cannot open the specified serial port;
    LabVIEW cannot find the file serpdrv.
    Make sure that the serial driver was installed before the board, and that the com ports appear normally in the control panel. If you cannot get it working, contact NI through either phone or email support. Since there are several potential causes, this is difficult to diagnose without more information. You can contact NI using the following webpage.
    http://sine.ni.com/apps/we/niae_asc.main
    Kim L.
    Applications Engineer
    National Instruments

  • Reading Serial Port?

    Sorry, I'm not sure if this thread is the same thing but is Java capable of reading in 15 pins RS-232 port data stream? If so, could some one please point me to a good place to start, such which classes shall I use? thanks

    Peter__Lawrey wrote:
    You are right serialization and serial ports have little to do with one another.
    You could start by looking at [http://java.sun.com/products/javacomm/]
    I couldn't find an obvious forum for serial ports either [http://www.google.co.uk/search?q=java+serial+api+forum]
    Thanks, Pete. Thanks, George. It seems like Sun is no longer supplying Javax comm development kits from that link. I take that all newer version of JDK are shipped with it?

  • "how to read serial port using labview 6.0"

    sir i am doing a project and is in a need to extract data from serial port. can anyone help me

    This link, and the links from it, are a great place to start:
    http://zone.ni.com/devzone/conceptd.nsf/webmain/8DECBF3E0B714BF3862568F9006E7851?opendocument
    2006 Ultimate LabVIEW G-eek.

  • Error 37 using serial port with an executable file

    Hi all,
    I have developed a VI that controls a setellite receiver using RS232
    serial port (LabVIEW 5.1.1).
    The VI program run properly, but when I compile it and try to run the
    executable file I receive an "Error 37, Device not found" error message.
    I have already put serpdrv and my_file.ini files in the same directory
    of my executable program my_file.exe, but I have not been able to solve
    the problem.
    Any help greatly appreciated.
    Regards
    Antonio
    Sent via Deja.com http://www.deja.com/
    Before you buy.

    [email protected] wrote:
    >
    > Hi all,
    > I have developed a VI that controls a setellite receiver using RS232
    > serial port (LabVIEW 5.1.1).
    > The VI program run properly, but when I compile it and try to run the
    > executable file I receive an "Error 37, Device not found" error message.
    > I have already put serpdrv and my_file.ini files in the same directory
    > of my executable program my_file.exe, but I have not been able to solve
    > the problem.
    > Any help greatly appreciated.
    >
    > Regards
    >
    > Antonio
    >
    > Sent via Deja.com http://www.deja.com/
    > Before you buy.
    Maybe you used the serpdrv from an older version of LV
    Regards, Roland
    Roland Lampka - Nortel Dasa - ESN 565-7257 - FAX 8160

  • Street Atlas 6.0 error message No Serial Ports Available (have Keyspan 19)

    Each year we travel the Pacific Northwest most of the summer in our motorhome.(To hot down here in Texas) I have been using Street Atlas USA 6.0 on my G3 366 IBook with a Garmin E-Map and a Keyspan USA-19 USB to Serial adaptor for five years. This version runs only on OS9. Garmin refuses to produce a OS 10 version. Worked well. Last year had problem with IBook including failed CD Drive. (IBook has traveled 85,000 miles in the motorhome) Had to replace CD drive, and did a clean install of OS10.2.6 and updated it to 10.2.8. (Need OSX for WiFi access when traveling) Did clean install of OS 9.2.2. Reinstalled Street Atlas, Keyspan driver (2.5) and extension and control panel, and reconnected the EMap GPS receiver. Inserted the Keyspan device into the USB port. (USB works with printing, scanning, etc.) Executed Street Atlas, and attempted to initalize the GPS, received error message from Street Atlas 'There are no serial ports available'. Replaced the Keyspan adaptor, reloaded software, same problem.
    Question: Has anyone else had the same problem, and resolved it? Does anyone know of potential extensions which would cause a conflict causing this?
    I have looked in Route 66, but the reviews on Amazon are pretty bad, calling it crap software. Has anyone had experience with it on a similar hardware/software set up?
    I considered buying a new i-book, but without an acceptable application to run under OS X, that would be useless.
    Help
    G5-20"IMac & G3-I-Book   Mac OS X (10.4.3)   I-Book runs OS X 10.2.8 and OS9.2.2

    Hi, I had the same configuration and problem, I hope a simalar fix will work for you. In classic Search for "Keyspan USA-19W Manager", open it up and check the box for "Emulate Printer Port". Go back and try Street Atlas 6.
    Regards, Kirhofer

  • Occasional freeze when reading serial port

    I've a labview application which is a gui for a remote device via RS422.  The host computer is a quad core running XP SP3.  Initially I was developing with labview 7.1.1.  At random intervals (anywhere between 10 minutes and 5 hours observed), labview will freeze.  Using a port monitor during this freeze, I'm able to observe repeating calls for IOCTL_SERIAL_GET_COMM_STATUS followed by IRP_MJ_READ.  VISA is configured for 0.5s timeout.  The serial card is a MOXA, CP-114EL (4port RS422).  During the freeze, Labview cannot be closed.  Sometimes it will try by displaying the "Resetting..." text but it never completes.  A hard reset is then required.  After the freeze, processor usage is 25% (on average, 1 processor working full time for labview, but bouncing between cores).  Before the freeze, its less than 2%.
    At first I investigated the serial card driver via emails with MOXA.  After running a terminal emulation program and a loopback connector they gave me for several days without their program freezing, they're confident the problem isn't with their card or driver.  During discussions with them, I installed the evaluation of LabVIEW 2009.  The program still freezes except now I have less access to the VI (I used to be able to switch to the block diagram and via the highlighter tool observe it stuck in the read operation.  In either version though, the above mentioned port monitor output is the same.
    My instinct is that the source of the problem is in the multi-core application, some kind of timeout race condition.  My VI is fairly simple in summary, write a command (read temps, read status, write new params, etc) and wait for reply timing out if there's a problem.  Repeat.  Serial port is configured for 115kbps and transfers are in binary.  Before the freeze, the communication works well.
    I appreciate any suggestions.  I've looked around the net and this forum and didn't find anything similar.  Long time reader, first time poster.  I've a lot of experience in labview but can't solve this - the random interval doesn't help.  I think I'll start logging all serial transfers and see if anything always occurs before the freezing.

    This morning I updated the labview drivers to the most recent online (I hadn't done that yet when I installed LV2009, download was large).  It was something I planned to try if the LV2009 change alone did not resolve things.  The update also did not solve the serial freezing problem.
    I've attached two captures from NI Spy, one during normal operation and one of the last capture (up to the arrow).  I did a brief probing of a different VI that isn't a part of this afterward.  You can see the Read request of Com 2 for 266 bytes.  In the before image, red lines are timeouts.  So this read request is hung up waiting for bytes and never timing out.  That's at least my interpretation.
    I appreciate your and tbob's suggestions.  I've a new serial card (Brainboxes PX-310 card) to try coming soon, not that I don't want to solve this, I just can't spend too much time on it.  If it still gets hung up on the new card, I'll look into the motherboard PCIe port, maybe a failing transaction.  I would've went with the NI card but I need electrical isolation and 8 ports is excessive.
    Attachments:
    NI Spy - before freeze.JPG ‏104 KB
    NI Spy - after freeze.JPG ‏108 KB

  • How to read serial port and substring

    I am new for labview .I send data from microcontroller with C languange every 1 minute this codeprintf("T%3.2f,H%3.2f",fTemp_true,fRh_true);
    And I read data with Hyperterminal it show this T29.11,H67.88 I want to show 29.11 and 67.88 only and stroe in database. I study connect serial port in example and I have a question. If I use this code.Can I auto read every 1 minute or this code can read 1 time only and I have to click every 1 minute.How to auto read when I send data to serial port with microcontroller every 1 minute. And I cannot substring 29.11 and 67.88 because %3.2f can show T29.11,H67.88 or T129.11,H100 . and  How can I simple send data to database. Thank you . 

    No, you don't have to click run every minute. You just need to place a while loop around the VISA Read. You could use Wait (ms) but it would be better to use something like the Elapsed Time function and wire the time has elapsed output to a case statement with the VISA Read inside the true case.
    This is one way to parse the string:
    If you have the database connectivity toolkit, you can easily write to a database. There is also something called LabSQL.
    Message Edited by Dennis Knutson on 01-22-2010 01:42 PM
    Attachments:
    Parse String.png ‏16 KB

  • Error while reading USB Port : using JSR80

    Hi Everybody
    Iam trying to read the data from a usb device [a fingerprint scanner] by using jsr80 with the help of following files which are in my classpath
    1) jsr80-1.0.1.jar
    2) jsr80_ri-1.0.1.jar
    3) jsr80_windows.jar
    4) commons-logging-api-1.1.1.jar
    5) javax.usb.properties
    6) LibusbJNI.dll
    7) LibusbJava.dll
    8) libusb0.dll
    I was trying the follwoing program
    import javax.usb.*;
    import java.util.List;
    public class TraverseUSB
            public static void main(String argv[])
              try
                  // Access the system USB services, and access to the root
                  // hub. Then traverse through the root hub.
                  UsbServices services = UsbHostManager.getUsbServices();
    System.out.println("Getting Available USB Services ");
                  UsbHub rootHub = services.getRootUsbHub();
    System.out.println(" Access to the USBrootHub ");
                  traverse(rootHub);
              } catch (Exception e) {
              System.out.println(e);
            public static void traverse(UsbDevice device)
              if (device.isUsbHub())
                 // This is a USB Hub, traverse through the hub.
                 List attachedDevices = ((UsbHub) device).getAttachedUsbDevices();
                 for (int i=0; i<attachedDevices.size(); i++)
                   traverse((UsbDevice) attachedDevices.get(i));
              else
         System.out.println("USB Device");
                 // This is a USB function, not a hub.
                 // Do something.
    }but when iam executing the program iam getting the exception
    The Ordinal 44 could not be located in the dynamic link library "libusb0.dll" , it is coming in a message box
    javax.usb.UsbException: Error while loading shared library LibusbJNI.dll : C:\WINDOWS\LibusbJNI.dll:
    The operating system cannot run %1
    Please help in this regards
    Thanks in adv
    Sulfikkar

    I am also facing the same problem with the code and getting errors while running my application in Eclipse is this some version problem or any other isues are afftecting my application to run successfully.
    I get following errors while running my application inspite of having all the jars and libusb for windows:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
         at com.mcreations.usb.windows.JavaxUsb.<clinit>(JavaxUsb.java:65)
         at com.mcreations.usb.windows.WindowsUsbServices.<init>(WindowsUsbServices.java:46)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
         at java.lang.Class.newInstance0(Class.java:350)
         at java.lang.Class.newInstance(Class.java:303)
         at javax.usb.UsbHostManager.createUsbServices(Unknown Source)
         at javax.usb.UsbHostManager.getUsbServices(Unknown Source)
         at org.symphony.embedded.ShowTopology.getVirtualRootUsbHub(ShowTopology.java:56)
         at org.symphony.embedded.FindUsbDevice.main(FindUsbDevice.java:29)

  • Build Error: "VISA Configure Serial Port"

    Hi,
    I want to upgrade some old 6.i vi's to 8.5
    But on building the project  i am getting an Error:
    Please take a look in to the screenhots
    Greetings from the lake of Constance, Germany
    juergen
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=
    Attachments:
    MESSAGE.jpg ‏106 KB
    VI-LIB.jpg ‏783 KB

    Hi j_dodek, there is a function called "mass compile", did yoou already try this option?
    Please select Tools»Advanced»Mass Compile and choose the directory containing your old VI's. This will upgrade all the files in the directory or library.
    Please also have a look at the linked document that describes what the function mass compile does:
    http://digital.ni.com/public.nsf/websearch/654877E62A97B72986256C95006F9B24?OpenDocument

  • Problems reading the serial port with labview 5.1.

    I open the example serial.vi , I select write to serial port, run the programm, I don`t have any problem. But when I select read serial port, I get the error code 16392and hex code error x4008. I need to know what can I do? Thanks a lot

    Any time you get an error in LV you can right click on the error cluster indicator and do a "Explain Error".
    If you do this for the error code you reported, the explanation says that it was a framing error.
    In serial communications, a framing error indicates that the hardware was not able to detect a start bit, data then the stop bits that comprise a frame.
    This prompts me to suggest that you check you port setting on the serial port. You want to make sure you are setting the port for the correct;
    Number of start/stop bits,
    Baud rate
    data bits
    parity (just for good measure)
    and hardware handshaking.
    I hope this helps,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Locking access to serial ports

    I have two instruments on serial ports, and two independant VIs to control them. One VI may be running, or both, at any one time. The VIs may be running under LabView, or executables.
    I would like some simple and elegant way of ensuring that when I run the second VI, it cannot access whichever port is being used by the first VI. I have experimented with using the VISA Lock Async.vi, which should do exactly that. However, it seems to be possible to have two VIs lock access to the same port, without generating an error. I can only assume that the "lock" is for the application (LabView), not the VIs.
    I have looked at the synchronisation functions for a solution, but I can't see any reasonable way of using them. Semaphores are ok if you want to control access to a single port, but not the undefined list of ports that may be available on any given machine.
    I could use a global array variable containing a list of ports in use. Not very elegant though...

    CDancer a écrit:
    Thanks, guys, but I don't think you have understood my problem. Read the first sentence - 2 completely independant VIs, and 2 or more ports...
    I have written a program today using the globals option, which works very well. There should be a better way though.
    Chris
    ViLabWorks a écrit:
    It isn't exactly clear to me why this is about one port. How much does one serial port cost versus programming time? Or even if it is about 4 serial ports the same applies. For me there is no question, doing something perhaps difficult versus spending next to nothing to solve the problem.
    Well...
    Sometimes you need to access the same equipement from different places in your application, or from different applications...
    Usually I simply set/read a global "busy" boolean.
    One problem I would like to adress is the automatic detection of specific serial hardware. How is it possible to find the port on which some equipment has been connected ? Of course, a solution would be to try to connect to this equipment by sending a command and waiting for the proper answer. However, before doing that, you need to detect the available ports (VISA Find Ressource), then scan each port after setting the proper baud rate, byte length, parity, etc..., then close the port to make it available to another application. Unfortunately, within LabVIEW, this procedure may interfere with other vis already connected to other serial equipments, with impredictable results.
    Apart the solution proposed in my first post, I don't know a way of deciding if a port is already in use. May be I missed something ?
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

Maybe you are looking for

  • Consuming ABAP webservice in Java

    Hi Gurus, We are publishing webservices from SAP and Java team is consuming them. For accessing the webservice  from java , we are maintaining User name and Password in SICF for that service. Now if we donot maintain the User name and Password in SIC

  • RTF Format doesn't display correctly on certains computers

    Hi, Entourage was my regular email program so far. I've been trying for a while Mail and it pleases me. However, there seems to be a bug. Since I need to send formatted emails (essentially italic, bold), I use the RTF format. Lots of my clients (who

  • Ipad App Open PDF Links But Can Not Go Back

    Hi i have just created an iPad app using the HTML5 Captivate App Pacakger. In my course I have links to PDFs that open in a new tab that work great in a browser situation. Now that i have published the app an iPad IOS app when i click the link to the

  • Using deb/rpm installer scripts with ArchLinux?

    I'm having an issue with installing some education software from a CD-ROM(LPL Symbolic Logic stuff), and although it supports Linux, the software is installed via either one of two installer scripts, one for dpkg and one for rpm. Since I have neither

  • Subtotal text in "REUSE_ALV_GRID_DISPLAY_LVC"

    hi all,   how to display subtotal text using "REUSE_ALV_GRID_DISPLAY_LVC" thanks in advance.