Visa serial write

i need to connect my electronic hardware/instrument with labview serial visa. i need to enter multiple entries as input like frequencies, data patterns in binaries. but labview serial write accepts only single string as input. pls suggest how should i proceed?

It really depends on the command format your instrument wants.  Some instruments will let you insert a semicolon between commands and write the one long string.  Others will require separate writes.  I would use a FOR loop in this case (iterate on an array of strings).
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

Similar Messages

  • How does VISA serial write work?

    I am using LabView 6.0 and the VISA functions to run a distributed sensor network using RS-485 from a NT 4.0 machine.
    In order to work properly I have to manually control the RTS line which isn't a problem using the property node.
    Here's what I want to know.
    I'm using a sequence structure:
    I'm writing a command using VISA serial write
    Then in the next frame I unassert the RTS.
    Now in this setup does Labview pass the command to the serial port and then jump to the next frame in the sequence, or is there some kind of acknowledgment from the serial port that its done so the Write vi knows to finish, or am I running a the risk of cutting off my communication before I've finished or should I put in a short wait after the write to port
    , or could this cause me to miss the reply?

    Robert:
    With the default settings, VISA Write will not return until the data has been at least posted into the hardware FIFO. To be 100% sure that the data has been transmitted over the wire, you should do these 2 things:
    1) Call VISA Flush I/O Buffer with a mask of 32. This will ensure the data has been at least posted into the hardware FIFO, regardless of which settings are being used.
    2) Wait a tiny amount of time for the FIFO to be emptied. This is based on the number of bytes in the FIFO and the baud rate. For example, with a 64 byte UART FIFO and 9600 baud, you should wait 67 milliseconds.
    Dan Mondrik
    Senior Software Engineer, NI-VISA
    National Instruments

  • Using VI Example Basic Serial Write Read to send AT commands to Cell phone modem error 1073807360

    I am using the NI Example VI: Basic Serial Write and Read to send AT commands to a Cell phone acting as a Modem.  I can send AT commands to this phone using Hyperterm when I select the modem driver by name in the hypert port selection field but not as com 7 which it occupies according to device manager modem properties. The basic serial vi does not show the modem driver as a selection, only ports by comX are shown. I get error 1073807360.

    Have you tried to put the name you enter in Hyperterminal in the VISA resource control? If Com 7 doesn't show, you can simply type "COM 7" in the VISA resource control. Or use "ASRL::INSTR 7".
    Also, make sure the connection in hyperterminal is closed, before you open the port in LabVIEW.
    Hope it helps,
    Wiebe.

  • Memory problem using visa serial functions in my vi

    The last few days i created an application that reads data from one of
    serial ports (contactless card reader). Today i noticed that my
    application had crashed and Windows had displayed a message that my
    system was low on virtual memory. I reset the system and i re-run the
    application, having the task manager opened. I noticed that the memory
    usage of my exe was taking more and more memory (starting from
    21.520KB) as the seconds went by. In 5 minutes my app was using
    25Mbytes! What i do in my application exactly, is opening the serial
    port  then i enter the main while-loop, then every 2 seconds i read
    from the  serial and write them to a tag.
    I have used standard visa serial functions of Labview. When I trace my
    application and simultaneously run TASKManager of windows to see the
    memory, I saw that after running every Visa function memory usage goes
    up!!!
    what must I do? Please help me to overcome this problem.
    Thanks,
    M.Naghipourfar

    Trust me, people use serial communication with LV all the time without losing memory. I can't check the example at the moment, but If it had a problem someone would have caught on to it by now. In any case, even if using the serial VIs causes the memory usage to go up, it shouldn't be dramatic, definitely not enough to crash the application and consume all memory.
    Like I said, post your code (there is an attachment field when you write your message and you can save all your files into a single file by opening the main VI and selecting File>>Save with Options>>Development Distribution) and we will probably be able to find your problem.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!

  • VISA serial not working right in Windows 7

    Howdy.  I wrote a fairly straightforward VISA serial read and write program in LV 2010.  I use VISA write to send a query through the COM port, then use VISA read to get the response and display it for the user.  I do this for several more addresses, then go back to the first one, and then it continues to loop over and over. It works fine when I run it as a vi on my computer, and it runs fine when I compile it and run the executable from my computer as well.  My computer has Windows XP.
    However, when I transfer the exe to a laptop running Windows 7, it either works sporadically, or not at all.  I know LV is installed correctly because a couple other small programs work fine, and as I said this one will occasionally communicate, although usually I'll see the wrong address being displayed.
    At first I thought it was my code, but no matter how many different methods I tried, it would always work perfectly fine under XP, but awful under Windows 7. Then I ran into Windows 7 USB and COM port driver issues with a different, nonrelated software program, so now I'm beginning to suspect it may be Windows 7 that's the culprit and not my code.
    ETA:  LV is the only program running on the Windows 7 laptop, so I know there is nothing else trying to use the COM port.  Plus, I have shut LV completely off and restarted to make sure LV itself isn't still holding the COM port and that didn't help either.
    Anyone else run into something like this?
    Amateur programmer for over 10 years!

    Actually my LV code is talking through a standard DB9 COM port.  It was another software application I use that communicated through a USB-to-COM converter that I found worked fine via plug-n-play in XP but I had to go through multiple steps to finally get it to work under Windows 7.
    Here's a sample of my code.  This is step 4, so I've already established my COM port settings earlier.  It sends out a query, in this case "MD 8009", and the microprocessor will echo back the query plus a value, like "MD 8009 75".  The serial communication in this device is very slow, so I send the message, then I have to loop for a while until I see a response that includes the original string plus more data.  If I don't see a reply that looks correct after so much time, I try sending the query again 20 more times before I give up and flush the I/O buffer then move on to the next address.  If everything works well, I store and display the data, flush the I/O buffer, then move on to the next query.
    Amateur programmer for over 10 years!
    Attachments:
    Com port LV.JPG ‏90 KB

  • Is it possible to interface digital i/o modules using VISA serial?

    Hi,
          Iam using analog and digital modules from trycom for my project.I interface analog modules by modifying the sample code basic serial read and write given in LabVIEW examples.But i found difficulties in interfacing with the digital i/o modules.Is there any sample code forDigital I/O?Is it possible to interface the digital I/O using VISA serial?
    Please Mark the solution as accepted if your problem is solved and donate kudoes

    Also i found from the net that digital i/o modules can be communicate with Hyperterminal..Is it possible?
    Please Mark the solution as accepted if your problem is solved and donate kudoes

  • Merge a intensity graph to a Serial write/read

    Hey.
    I am doing my bachelor in Labview, and are using a arduino 2560 as a microcontroller for a thermal sensor.
    After many attempts on connecting the arduino to labview using LIFA.BASE I get connection sometimes, and sometimes not.
    I tried the Serial write and read program on the forum, and got much better reliability.
    I would like to use VISA, instead of Arduino int.vi
    I was hoping I could change the Serial write and read(removing the string) with putting an intensity graph in it?
    I have added the bachelor program along with the Serial write and read, can someone please help me??
    Attachments:
    bachelor_2013.vi ‏259 KB
    Modded Advanced Serial Write and Read_test.vi ‏40 KB

    There is the Simple Serial Write Read example.  That should get you started with talking over a serial port with VISA.
    It seems like you have an array of bytes that you need to send.  You just use the Byte Array To String to convert directly into a string and send it.  For reading, there is the String To Byte Array that you can use to start parsing your data.
    Show us what you have so far.  Be sure to include any sample data you may have and expected results.  Things get really confusing when stating ASCII and Hex since people can interpret that in 10 different ways.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • PDA (Pocke PC) - Serial Write Timeout

    Hello List,
    I am developing serial routines to communicate with external hardware. In many cases, XON/XOFF flow control is used.
    I have configured my PDA device to write out a large file. During the transmission, I use my development computer to monitor the transmission. During the transmission, I can send XON/XOFF characters to the PDA. If I send an XOFF, it will "pause" until I send an XON character. It works great unless I wait for more than about 3 seconds. If the PDA is forced to wait for more than 3 seconds, the transmission is terminated with an error. However, if I send an XON character, before the 3 seconds delay, it continues the transmission and no error occurs.
    It seems that a 3 second timeout is being enf
    orced within the routines but I have not been able to determine if I have control (within the PDA Serial Routines) over the timeout variable. Personally, I would like the timeout to be indefinite unless I want to enforce one.
    FYI: Based on industrial experience, for very large files, delays during the transmission of several minutes may be necessary.
    TIA,
    Guy

    Hello,
    I apologize for the delay in responding to your post. You are having a timeout issue when using software flow control (XON/XOFF) to transfer data between a PDA and a host computer, right? Are you getting error code 7 when the PDA times out? I was able to duplicate this issue here. This error code is a timeout error and it means that not all bytes have been sent. I spoke with members of the R&D team and they know about the problem. While they were unable to offer a formal solution at this time, they did provide a workaround which I hope works for you.
    Put a while loop around the serial write VI on the PDA.
    Continue the while loop until there is no longer an error code 7 (i.e. until all bytes have been sent).
    Essentially, this will ignore the repeated timeouts from the serial write VI. You can manually add a timeout mechanism by obtaining the time before the loop and checking it during the loop. However, you mention an infinite timeout is acceptable in which case no additional code is necessary.
    I have attached a couple of VIs that implement serial communication using XON/XOFF flow control and that use the above workaround. Please let me know if this solution works for you. If not, can you provide some additional details such as the error code and if the timeout is happening on the PC side or the PDA.
    Happy coding,
    Grant M.
    National Instruments
    Attachments:
    Serial_XonXoff_(Host).vi ‏55 KB
    Serial_XonXoff_(PDA).vi ‏68 KB

  • What property settings to I need to set in order for VISA Serial Read to read ASCII exactly like the legacy serial read vi?

    I have successfully built a vi which communicates with a piece of equipment via the serial port using ASCII characters. I am trying to replace the older versions of Serial Read and Write VIs with the VISA Serial Read and Write VIs. The VISA Write works fine, but the when reading data coming from the "box", the VISA Read VI returns string data with foreign looking characters instead of the usual correct ASCII characters as shown by a dumb terminal which is in parallel with the serial data line. Is there a special property node which needs to be configured on the VISA Serial Read vi, or do I need to set something on the VISA Configure Serial port v
    i?
    Why aren't the VISA serial vis compatible with the older serial vis?
    Thanks...

    Usually, garbage characters are an indication of a baud rate or parity mismatch, or maybe a stop bit or number of data bits setting. Make sure that you have configured your port correctly with VISA Configure Serial Port. I have used VISA serial successfully many times.
    - tbob
    Inventor of the WORM Global

  • Visa read & write

    How can I use visa (serial port) to write in COM and read from another.

    Then look in the Example Finder (Help->Find Examples) and do a search for Simple Serial Write & Read.  It is an ok example of how to perform a write to an instrument and then read data coming back from it.  You should be able to easily expand it to write on one port and read on another.

  • Inconsistent serial write

    hello,
    I'll be brief. I'm a novice, still trying to get the feel of labview. Somehow there's an inconsistency of the serialwrite.vi in my program. Using a protocol analyzer, I could see that sometimes the serial write doesn't send all the strings in the command text box. (For instance, the value of the command textbox is "send 200", and sometimes the serial write only sends "se"). I followed the guideline for serial communication: initialize (baud = 9600, databits = 8, stopbits = 2, parity = none), flush the buffer before writing to the serial port, send the string to the port, have a serial port break to wait for response, and count the number of bytes on the serial port before reading them. I use R-232, and I also have checked the "updat
    e value while typing" on the pop up menu of the command textbox. My program is attached. I will appreciate any help in any way. Thank you!!

    Try using VISA instead of serial VIs. VISA is lot better to use in almost everyway. There is a VI on your computer ( that has Labview on it )named, serial communication.vi That VI will help you understand the use of VISA in serial communication. But for some reason if you have to use Serial VIs then attach your VI on this developer exchange and I will try to troubleshoot the problem.

  • GPIB reads/writes compared with VISA reads/writes

    Hello all,
    Being slightly new to LV (3 months of casual use, and 1 month of really getting to know it)...
    I was just wonder what the difference between VISA reads/writes and GPIB reads/writes.
    Actually this is my main question: Is the GPIB Write "data" parameter and the VISA Write "write buffer" parameter the exact same thing?
    Would I write the exact same command with either parameter and get essentially the same effect (if all parameters are correct?).
    I have a list of GPIB commands that I want to use to write drivers for  a PSA, and I really want to use VISA, and not have to change my paradigm of thinking.
    I would hope they are quite similar.  In fact, my research is telling me that GPIB is almost like a subset of VISA?
    Thanks for your help.

    The data you write with the GPIB functions is identical to the data you write with VISA. There are some things that are a bit easier to use the traditional GPIB calls but for 99+% of the time, VISA will do the trick. VISA was originally conceived as a common api for GPIB and VXI instruments. The first VXI instruments were basically the same GPIB instruments without a power supply and the user interface (buttons, screen, etc.) but they required different drivers. VISA permitted a single driver to be used for both types of instruments. Now, VISA has expanded to include serial, Ethernet, USB, and PXI and not having to change your "paradigm of thinking" is one of the big reasons that VISA is so widely used.

  • RT Network Shared Variable and Visa Serial Instr class

    Hi,
    I'm using Labview 2009 SP1 with the RT module. I've had no problems creating a RT Target application and a Host PC application which are interconnected using Network Shared Variables, until I came to the COM ports fitted to the RT Target (PXI Embedded Controller and 2 x 4 port COM cards).
    I can configure and use the COM ports in the RT Target application providing I use constants to define which COM port to use, i.e. VISA OPEN function accepts hardcoded "COM2" , (VISA Serial Instr class).
    But I want to pass the COM Port resource name from my host application. 
    Is there a suitable Network Shared Variable I can create ? or how do I change the string value (COM Port name) of the VISA Serial Instr class variable in the RT Target application ?
    thanks,
    Gary.

    Hi there Gary,
    Thanks fot the post. I think I have found something that may be if use to yourself.
    http://labviewwiki.org/Functional_global_variable
    This is the functional global variable.
    Take a look at it and let me know what you think!
    Many thanks,
    Liam A.
    National Instruments
    Applications Engineer

  • Is this "OK"? Lots of Serial Write.vi's !

    Hello all. I had a recent post and two excellent responses about how to get a constant FALSE condition to send a command ONCE, and a constant TRUE condition to send a command ONCE. In other words, while the buttons are "idle", nothing is being sent. The attached VI works great, but look at all the Serial Write.vi's! It doesn't really bother me, but is it just seems wrong. Are all those vi's "doing something" while they sit there in the case structure? Is there a way to get ONE Serial Write vi outside of the cases? Or should I care?
    background: In my other applications, the hardware has a FIFO and memory and I can concatenate lots of strings and send them to ONE Serial Write vi. In my new application, it's paramo
    unt to send ONE command and stop, hence the imbedded case structure and shift register to tell that a key has been pressed. The other attached vi is an example of what works on my old hardware but not the new stuff, so you can get an idea of why the new program seems so fat.
    Richard
    Attachments:
    WriteOnce.vi ‏58 KB
    ABSsub_VL&P.vi ‏91 KB

    If you want to use a single serial write, you can programmatically build your device dependent data string. See attached.
    P.S. What a great user profile name. Wish I had thought of it.
    Attachments:
    build_ser_string_programmatically.vi ‏37 KB

  • Strange serial write problem in labview 8.5

    I'm having a very strange problem with simple serial port write in labview. I'm running the 'Advanced serial write and read.vi' program from NI examples. I connected a microcontroller board on the device side. The board has been programmed simply to blink an LED fixed number of times. For example if I want my LED to blink 13 times, that is specified in the labview 'string to write'  field. I ran the program in hyperterminal window. It runs successfully. But whenever I'm running it in labview it is giving strange response, for example if I give input in 'string to write' field 18/13/15, it blinks 11 times, similarly if I try to run it 21/26/29 times every time it runs 22 times. That is the controller only acknowledges the MSB and duplicates the other bit with it. Since it is running fine in window's hyperterminal, There must be some adjustment need to be done in labview. And that I cannot figure out. Please anybody give some solution.Any suggestion is appreciated.
    With Regards,
    Tapabrata

    Please post your program or a stripped down version (we probably do not need all the signal processing) which shows the problem.  Make sure that all the controls for the serial port are set to your default values. Also, provide the exact communication protocol you are using.
    When you say you want to write in "real time," please specify what you mean. That term is used in several different ways and is often misinterpretted as a result. How often do you wnat to write? How much timing jitter or error can you tolerate?
    Most likely what you want can be done, but without seeing the code it is difficult to say what might be wrong.
    Lynn

Maybe you are looking for