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.

Similar Messages

  • 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.

  • Increase speed visa read write

    Hi guys,
    I am using the visa read and write example, but I am facing some issue when using it in a larger software, and I can only receive date when the vi has been slown down (using the lightbulb).
    The programme definitely works on it own with the settings defined. 
    Therefore, do you have any ideas/suggestions on how to increase the speed of this vi (attached) significantly? Also, it seems to create an issue with the data read
    Many thanks,
    Kentmey
    Kentmey
    Solved!
    Go to Solution.
    Attachments:
    Read and write.vi ‏22 KB

    How are you using this code inside of another VI?  If you are actually calling this VI, there needs to be some changes.
    1.  The port should only be initialized once at the beginning of your program and clsoed once at the end.
    2.  There shouldn't be any  need for the bytes at port.  You are set up to use a termination character.  So just set the number of bytes to read to something really large (like 50 or 100) and let the VISA Read stop when it finds the termination character.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Error x3FFF0006 in VISA Read/Write

    Hi,
    I am getting this error message sometimes in VISA read and sometimes in VISA write. Its not consisten. Its only thrown in certain VIs. What could be the issue? I am attaching my main VI, where I configure serial port, and the VI where this error is thrown.
    Thanks.
    Attachments:
    Main.vi ‏39 KB
    Error.vi ‏30 KB

    It's a warning and not an error.
    The VI that is showing the warning is a little weird. You configure the serial port to terminate the read with a termination character but then when you do a read, specify the byte count and if the bytes read does not equal what you specify, you try to do another read. You usually don't do both.
    If you specify a termination character with the VISA Configure Serial Port, the VISA Read will terminate when the termination character is detected. If you specify 100 bytes to read and there are only 50 bytes and a termination character, all you will read is 50 bytes. If you disable the termination character detection, you will always get the warning. In this case, as long as you use the VISA Bytes at Serial Port to verify that there really isn't any more data in the buffer, you can simply ignore the warning.

  • Configure VISA Read to terminate on unique character sequence

    I am communicating with an instrument via a TCP connection using VISA read/write. The terminating character sequence from the instrument is "->" Is it possible to get VISA to terminate on this character sequence and basically not return these characters in a read?

    No, it can only be configured to terminate on a single character. If you know that '>' will not appear in your data you can use that as your termination character. Otherwise you need to create your own read VI that will look for a sequence of characters as the termination value.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • VISA Read hangs. Get Resetting VI dialog on abort.

    I also updated to the latest VISA and GPIB drivers available from National Instruments, and the same problems still occurs. Happened on the Keithley with an "*idn?" call again.
    Tomek

    I have the same problem with VISA Read (with a 1/2 second timeout) going to different instruments (I've seen it happen with a Keithley 2400 as the OP, but also SRS 830 Lock-in, and an SRS SIM module setup), and hanging both the VISA read and the UI.
    EDIT: Added:
    Windows 7 SP1 64-bit
    LabVIEW version 9.0f3 (2009)
    VISA Versions: 5.0
    Ni-488.2 Version: 2.73
    One thing that might be tripping things up is the inclusion of an IOTech Extender488/F bus extender/isolator, which uses a fiber optic cable to span a distance and provide some separation between computer ground and instrumentation.
    Because of some debugging I was doing, I left NI Spy open, and have the following results from the last calls:
    19859184.  viParseRsrc (0x0C818D20, "GPIB0::23::INSTR", 1, 0), Process ID: 0x00001414         Thread ID: 0x00001600, Start Time: 10:48:45.027       Call Duration 00:00:00.001,Status: 0 (VI_SUCCESS)
    19859185.  VISA Open ("GPIB0::23::INSTR", True, 0, 0, "GPIB0::23::INSTR"), Process ID: 0x00001414         Thread ID: 0x00001600, Start Time: 10:48:45.028       Call Duration 00:00:00.038, Status: 0 (VI_SUCCESS)
    19859186.  VISA Lock ("GPIB0::23::INSTR", 0, 1), Process ID: 0x00001414         Thread ID: 0x00001600, Start Time: 10:48:45.066       Call Duration 00:00:00.000, Status: 0 (VI_SUCCESS)
    19859187.  VISA Set Attribute ("GPIB0::23::INSTR", 0x3FFF001A, 500), Process ID: 0x00001414         Thread ID: 0x00001600
    Start Time: 10:48:45.066       Call Duration 00:00:00.019, Status: 0 (VI_SUCCESS)
    19859188.  VISA Unlock ("GPIB0::23::INSTR"), Process ID: 0x00001414         Thread ID: 0x00001600, Start Time: 10:48:45.085       Call Duration 00:00:00.010, Status: 0 (VI_SUCCESS)
    19859189.  VISA Lock ("GPIB0::23::INSTR", 0, 1), Process ID: 0x00001414         Thread ID: 0x00001600, Start Time: 10:48:45.095       Call Duration 00:00:00.010, Status: 0 (VI_SUCCESS)
    19859190.  VISA Write ("GPIB0::23::INSTR", "*idn?"), Process ID: 0x00001414         Thread ID: 0x00001600, Start Time: 10:48:45.105       Call Duration 00:00:00.018, Status: 0 (VI_SUCCESS)
    19859191.  VISA Read ("GPIB0::23::INSTR", 100), Process ID: 0x00001414         Thread ID: 0x00001600, Start Time: 10:48:45.123
    You'll notice that it crashes on "*idn?". I'm pretty sure that in the past, it has crashed on other commands as well, and is not reproducible (for example, I ran visa read/writes to the SRS lockin every 200ms or so for the past 12 hours with no problems, with at least 60+ calls (including *idn?, which is part of a class constructor) to the Keithley. 
    I am happy with a solution which kills that read command, and simply issues an error -- I can handle those. But it is frustrating that I cannot trust that the VISA read will either work or throw an error that I can catch.
    Any help or guidance in diagnosing this would be appreciated. Please let me know if I have missed reporting on something...
    Thanks,
    Tomek

  • VISA Read Timeout and VISA Write not working

    I'm writing a program that sets a triangle wave pattern voltage (using Triangle Wave VI) to a DC power source (GWInstek PST-3202) through a RS-232 connection.  I know my instrument parameters are set up correctly because I've been able to control this power source using a different VI with the same parameters.  I also know I am connected to the power source because I can talk to it using MAX.  I have a string indicator before my VISA Write statement that shows me the command being sent to VISA Write.  It shows the correct syntax for setting a voltage on this instrument.  However, when I run the VI, the voltage is not changed on my instrument, even though the correct command is sent to the instrument.  After the VISA Write operation I have inserted a VISA Read function in order to read the newly set voltage from both a numeric and a waveform indicator.  Using the Error Out cluster I am able to see that there is a timeout error from VISA Read.  I thought perhaps I needed to clear or flush the buffer after each Read statement, but that didn't work either.  I'm stumped as to why VISA Write isn't writing to the device.  I have included my VI below, as well as the initialization subVI for the power supply.  
    Attachments:
    Triangle Volt Mod.vi ‏27 KB
    GW Instek initialization.vi ‏18 KB

    Yep, you need to append the End of Line character to the end of your command.  And for your read to work properly, you need to request the data.  That requires a querry command to be sent.  Look closely at the differences in command and communication structures between your working VI and your mod.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • VISA to read/write COM1

    Dear all,
    This is a simple example to test VISA to read/write my COM1,
    I have Labview 8.6 and even downloaded and installed the VISA441 again.
    But it doesn’t read anything from COM1.
    The error message is “timeout expired before operation
    completed.”
    I appreciate for your help.
    Raymond
    Attachments:
    my visa write read.vi ‏8 KB

    What are you communicating with?  Are you sure you have the right kind of cable between the two.  Between 2 PC's, you would need null modem cable.  Between a PC and another device, you might need a straight through or null modem cable, you would have to check the manual for the device.  Are you sure you have the correct communication settings?  Usually you would need a small delay between the write command and the read command to give time for the other device to read the command and turn around and send back a response.
    Do you know what the return message is supposed to look like?  Does it need a termination character such as a line feed or CR/LF?  How are you running this VI?  It is set up as a one shot VI.  Are you using the Run Continuously button to run it?  I hope not.
    You should really look at the examples in the Example Finder such as Basic Serial  Write and Read.

  • Visa Read Timeout Occurs with multiple Reentrant VI Calls

    I have written a test application in Labview (6.1) which will be used to test (burn-in) up to 15 serial instruments through a 16 Port USB->RS232 Hub. Here's how it works:
    When the App loads, I am transmitting a Connect command to each of 15 com ports (one-at-a-time) using VISA. If I receive the proper response from the unit on that port, I add the port to an array and continue on to the next system. Once I've found all systems on the hub, I wire my array of active Visa references to a for loop in which I open up to 15 reentrant VIs which will run in the background in parallel. Each of these reentrant VIs (all are idential with the exception of the Visa Resource they use) running in the background are sending commands to the the respective instrument and receiving a response. One Function in particular "Get Unit Status" is important and the response determines whether or not the instrument is functioning correctly. Here's the problem -- In my Main Loop, I am continuously acquiring indicator values from each of the reentrant VIs that are running in the background. After a period of time (not consistent) I will lose communication with a port (the symptom is no response from the unit). I've looked closely at the COMM engine I created and found that the Visa Write function is completing without error, then when I perform a Visa Read I immediately get the "Timeout occured before operation completed" error (please keep in mind that this occurs after 100-5000 successful attempts at writing/reading). Eventually another port will drop out, followed by another. This seems to stop occurring and the remaining systems run to completion without a problem.
    Some background on what how I'm setting up my Visa Sessions...
    When I originally scan for systems (before I load and run the Reentrant VIs)
    - Init Visa Port
    - 19200, 8, N, 1
    - Use Termination = True
    - Timeout = 400mS (I've tried larger values already) 400mS should be plenty
    - Termination Char=13 (/r)
    - Open Visa Session
    - Visa Write "CONN18/r" (the command required to connect to my instrument)
    - Visa Read with 1 for requrested byte count to read 1 byte at-a-time, concatenating the results until /r is received (or 1000mS timeout occurs -- this is not a VISA timeout) I've also tried 16 for requested byte count and just waiting for Visa to timeout -- both methods work.
    Once all 16 ports are scanned I Close ALL of the ports using the Visa Close Function.
    It is important to know at this time that I "AM" using proper wiring flow to ensure open occurs before write, write occurs before read, etc.
    I'm assuming at this time that all of my Visa sessions are closed.
    On to the Reentrant VIs:
    Inside each reentrant VI I first Initialize all of my variables and Init/Open a 'New'? Visa session using the same parameters mentioned above.
    Then I enter the "Run" case structure where all of the communication begins.
    I am using the same Communications Engine to operate the instrument as before (the only difference being that all of the VIs in the comm engine are now reentrant and operate at higher priorities) I have actually saved two different versions of the engine (one for the reentrant calls and one for when I first scan for systems from my Main GUI).
    When I init the reentrant VI, I am placing the Duplicate Visa Resource output of my Visa Open Function on a shift register. When I enter the Run case, it takes the Resource from the register on the left, wires through any Comm Engine Vis then back out to the shift register on the right and keeps going for a 12-hour period or until "Get Unit Status" has returned 60 naughty results.
    On my Main GUI I am continuously (every 500mS) I am Getting certain Indicator Values from each reentrant VI AND I am also setting some control Values on each reentrant VI. There is no VISA interaction between each Reentrant VI, and the Main GUI.
    As I said earlier, up to 15 systems will run for a time, then one will stop responding, followed by another, and another until a few remaining systems will run to completion.
    Any advice as to why I'm encountering the timeouts with the VISA read fucntion as I have metioned would be appreciated. I managed to find one suggestion which uses the Bytes at Port function to ensure there is data at the port before doing a Read otherwise, skip the read and retry the whole operation -- I haven't tried this yet.
    Sorry for the wordiness of my question. If anyone would like some screen shots of portions of my code (I can't submit the actual code because some of it is confidential) I'd be happy to post them.
    Doug.

    Hi Doug,
    The first thing I would recommend is the solution you have already found, to check and see if there is data at the port before attempting a read. I would be interested to see if this will solve the problem. Does there seem to be any trend to which ports have this timeout error? How many ports does it cut down to before operation seems to continue as expected? Does this number vary, or is it always the same number of ports? I think the best thing to do will be to identify constant attributes of how the error is occurring so that we can narrow it down and see what is going on.
    John M

  • 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

  • Slow performanc​e to read/write shared variables programati​cally

    We are using datasocket read and write functions to read and write shared variables programatically (in the same machine) but we only achieve a performance of aprox. 200 reads/writes per second. We are using Labview 8.6 with DSC.
    Is possible to get better results? That performance is normal?
    Any help would be appreciated. Thank you in advance.

    Hi MMCDAT,
    I think this value can
    be normal as you can see in this link:
    http://zone.ni.com/devzone/cda/tut/p/id/5037
    As you can see, the
    limit for datasocket depends on your Ethernet limitations, even if you as using
    it just in one PC:
    http://digital.ni.com/public.nsf/websearch/6AC9E65​734E53F9A8625672400637ECC?OpenDocument
    You can improve the
    performance changing the update mode or Vis configurations:
    http://digital.ni.com/public.nsf/allkb/F8F7DE98856​B50588625672400648045?OpenDocument
    http://digital.ni.com/public.nsf/allkb/2D9C6D73A16​0537986256B290076456E?OpenDocument

  • Error 33172 occurred at Read & Write data transfer between two or more PF2010 controller

    Hi,i need to do data transfer between two or more FP2010 controller.e.g. FP2010(A) & FP2010(B).
    FP2010(A) need to transfer the measurement (from its I/O module) to FP2010(B) to do the data analysis.These data transfer should be synchronous btw two controller to prevent data lost.
    From the vi used in the attachment,i encountered some problems at:
    (1) Error 33172 occurred while publishing the data.Can i create and publish data under different item name?
    (2) How to synchronies the read & write btw contorller?
    All controller are communicating with each other directly without the need of a host computer to link them together
    Is there any other method to do fast data transfer betwe
    en controller?

    Hi YongNei,
    You were succesful in omiting enough information to make it very difficult to answer!
    Please post your example.
    Please tell us what version of LV-RT you are using.
    Please define what you concider "fast data transfer".
    Have you concidered mapping the FP tags of FP2010(A) to FP2010(B) and vise versa?
    WHat exactly has to be syncronized?
    If you have something that is close to working, share that.
    Well, that as far as I can go with the info you have provided. Depending on the details, what you are asking could be anything from trivial to impossible with the currently available technology. I just can't say.
    It would probably be a good idea to start over with a fresh question (sorry) because not many people are going to know what a a "
    PF2010" is and I can not guarentee that I will be able to get back to you personally until next week-end.
    Trying to help you get an answer,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Urgent!!! Need help in file read/write data to a serial port

    Hi,
    I really need someone's help in order for me to complete my project. I have attached a vi which I have taken from an example and integrate to my project. In the vi, I have managed to get the encoder counts using Ni 9411. I need to read/write that data from ni9411 to ni9870 without using any serial port as they are connected to a NI 9104 chasis. May I know whether I am correct in writing the data to my ni9870 port using the vi I have attached? Does anyone know how i can convert the number of counts to a 8-bit data/byte so that I can send the data through the RS232 port? I really need someone's help as I need to finished in 2 weeks time.
    I have also attached an vi on controlling the epos2 controller using instrument driver. Does anyone know how can i integrate this vi to the fpga vi (the one which I need to read/write data to 9870) as I need to send those data to control my epos2 controller.
    Please help me!!!
    Attachments:
    Encoder Position & Velocity (FPGA).vi ‏23 KB
    SINGLEMOTORMODIFIED.vi ‏17 KB

    Afai,
    As I allready suggested you here, call your local NI Office and ask for assistance!
    You really need assistence in a higher level that we can provide via the forums. Otherwise I don't see a chance for you to finish your project in time.
    1. Convert I32 to U8 to write it to the 9870 could be done like this:
    2. The vi to control the epos2.
    There is NO way ( absolutely NO way) to port this vi to FPGA. It's based on VISA calls, uses an event-structure, both are not available at the FPGA.
    The only thing you could do is to analyze the VI, the instruction set and design an FPGA vi which handles the specific instructions you would need.
    I have no experience with epos2 and I'm not 100% sure if this would work as you would like to use it. And doing this needs deep knowledge of LabVIEW, VISA, Instrument Drivers, the epos hardware, FPGA programming, and so on... 
    Christian

  • VISA file write works on 32 bit WIN 7 but not 64 bit

    I've got an application that has worked for years on several XP machines. It works on WIN 7 32 bit as well. It does NOT work on WIN 7 64 bit.
    I download a file as a binary, break it into 4096 bit packets and send each packet via VISA write to a UUT. I've tried setting the program to run in XP mode, run as administrator. I suspect it's the VISA drivers, and I've downloaded and installed NI-DAQ 9.8 but I'm not having any luck 
    Attachments:
    Download_File_As_Binary.vi ‏37 KB

    I'm using a CP2103 USB to RS-232 converter.
    The VISA reads and writes are in the attached sub-vi's
    Attachments:
    Download_File_As_Binary.vi ‏37 KB
    USBCOMM_Without_Open_Close_Port.vi ‏55 KB
    Initialize_Comm_Port.vi ‏15 KB

  • Can I read/write global variables that are in other PC?

    I attach the vis and the executables.
    My problem is that when I run( continuosly, because in other way, I read the default value of the variable) getvalue.vi and setvalue.vi, I don´t have any problem, I can read/write the global variables, the two vis is running in the same PC.
    But when I do the exe and I run them continuosly , it doesn´t work.
    Any solution?
    Thanks in advanced!
    Graci
    Attachments:
    Get_Value.vi ‏30 KB
    Set_Value.vi ‏30 KB
    Exe.zip ‏272 KB

    Hello Bichillo,
    By running the vis continuously you are running into race conditions. If you cannot control when you are writing to or reading from a global variable, you cannot know whether the value writen/read is the right one or not.
    In your case the global variable value that is read is sometimes the last value writen and sometimes an empty string.
    To make the global variable behave as desired, that is, keeping its last value, the global variable must be in memory when you access it using VI Server. If it is not in memory, the returned value is an empty string. That´s why you sometimes get a non-empty string: when you access the global variable to read its value, it happens to be in memory because you´ve just writen to it.
    To ensure that the global
    variable is always in memory and it keeps its last value, you must include the global variable into your block diagram. I am attaching modified vis that implement this.
    Hope it helps.
    César Verdejo
    Training and Certification | National Instruments
    Attachments:
    Get-_Set_Value.llb ‏48 KB

Maybe you are looking for

  • Pascal's Triangle Problem

    Hey there guys. I was looking around the forums seeing if there was anything that someone posted simliar to my assignment. While there were SOME similar things, I think mines a bit more specific. Let me just state here that I don't want anyone to jus

  • Question on using a different Apple ID for iTunes

    I have an established iTunes account that I used to download music, and purchase apps. My question is this: I recently purchased MobileMe. So I now want to use my MobileMe account with iTunes. But what will happen to my current songs, apps, etc, that

  • Building WSDL client for OIM SPML webservice

    Has any one created WSDL client for OIM SPML webservice, Any help is appreciated. Thanks, Pandu old thread --> add udfs to spml prov. request to oim ========================== Hi, I am provisioning users in OIM from by sending spml requests I used th

  • Erratic Zooming when getting wide

    I've always had issues with zooming the display getting absolutely out of control and showing me way too much where there's nothing. I'm working on a 5 minute documentary right now. If I zoom out by dragging the end of the horizontal scroll bar or by

  • Deleted workitems are moving from sap inbox to other inbox

    hi, The client is receiving the workitems which are deleted from sap inbox in their inbox. How the issue can be fixed? Thanks,