Control Instrument using RS232 port

I have tried to download the IVI driver of the Agilent E3633A that stated can communicate using GPIB or Serial.
I tried to initialize the instrument but no successful.
I used a twisted ( tx and rx swap) RS232 cable (female to female) to connect between the instrument and PC com port.
Please help to advice on how to control the equipments using RS232 port inlabview. Thanks!

Hello,
Here's what you can do to verify that you have established communication with the instrument.
First gather the relevant information:
1. Find a command that you know your instrument "understands" (it is highly likely that it will understand *idn? which should prompt the instrument to reply with a description of itself).
2. Verify the serial settings that your instrument uses by default, such as baud rate, number of data bits (likely 8), parity, and the number of stop bits. You can also verify what termination character the instrument uses (which it likely does); this is the last character you will need to send after sending the relevant command characters, and it will indicate the end of the command to the instrument so that it stops reading from the serial port. I doubt that the instrument is configured for flow control of any kind by default, so don't worry about that unless there is specific indication of this in the manual for your instrument.
3. Verify the type of your cable; that is, you will need to connect pin 2 of your computer's COM port to pin 3 of your instrument's COM port, and pin 3 of your computer's COM port to pin 2 of your instrument's COM port. Some cables automatically switch these connections with the wires inside the cable, others are "straight through." You can bypass the cables altogether and just use wires to make the relevant connections initially; don't worry about a twisted pair at first, just keep the wires short and you should be ok (unless you are in a particularly noisy environment).
Now build the LabVIEW program:
1. Open a blank VI
2. Navigate to and pin down the following functions palette on the block diagram:
All Functions -> Instrument I/O -> Serial
3. Place onto the block diagram the four VIs/functions in the top row in the order they appear (should be VISA Configure Serial Port, VISA Write, VISA Read, VISA Close); note that the open will be performed implicitly the property node inside the VISA Configure Serial Port VI (don't worry about this).
4. Hover over the upper left hand terminal of the VISA Configure Serial Port VI, right click, and choose
Create -> Constant; now select the PC COM port you connected your instrument to in the newly created constant
5. Create constants for the inputs to match the serial parameters that you found for your instrument above if the default values don't already match. Note that the defaults used by this VI include activating the linefeed termination character to be used when reading, as well as standard settings for serial port which may already match your instrument (check by hovering over the ports with the wiring tool; the default values will show in parenthesis)
6. Wire the top right hand terminal to the top left hand terminal of adjacent VI's (which should be in the order noted above); this connects the resource name to each so they perform the operations on the chosen serial port
7. Wire the bottom left to the bottom right hand terminals in a similar fashion; this connects the error clusters
8. Almost done... now hover over the remaining left input of the VISA Write function (called write buffer), right click, and create a constant; type *idn? (and include a linefeed character at the end by typing the key)in the string constant that you just created
9. Similarly for the read function, create a constant for the input that indicates the number of bytes to read (perhaps make this number 100 as you will likely terminate the read appropriately when a termination character is read; your instrument will likely send this), and create an indicator for the "read buffer" output which will show you the string that is read back when you run the program.
10. You should now be able to run the program; hope it works.
I would have included a screenshot or example instead of a description, but I don't have access to that at this time and perhaps it is best to actually go through the process of building the VI anyway if you are new to LAbVIEW.
Good luck and repost if you continue to have troubles!
Thank you,
Best Regards,
JLS
Best,
JLS
Sixclear

Similar Messages

  • How can I control instrument using its RS232 port in VB or VC++?

    1)How can I control instrument using its RS232 port in VB or VC++?
    2)What's the module or .h file need I add-in to VB or VC++?
    3)Can you provide me some easy examples for that?
    Thanks!

    Kevin,
    I've used Measurement Studio - Tools for Visual Basic and Tools for Visual C++ (ActiveX component) for instrument control.
    I've used both the VISA and non VISA versions and they are pretty straight forward to use for GPIB, Serial or VXI.
    You might find the following page useful.
    http://www.ni.com/mstudio/cworks.htm#ICC
    Regards,
    Kamran

  • Labview control of LS331 using RS232 port

    Hi All,
    I want to control a Lakeshore 331 temperature control using Labview. I am using RS232 port. I found driver on NI website but I guess they are for GPIB. I was wondering how can I use them for RS232 port?
    Or if I want to bulid my own VI, how do go about it? I would appreciate if someone provide me example for capturing device using RS232 port.

    The driver is written for both GPIB and Serial. You should replace the "Old" Visa Open function in LSCI 331 Initialize per the instructions here and try it. Once that's done, just select the com port by clicking on the VISA Resource Name.

  • "How can i control the instrument with SCPI command by Borland C++ v3.1 using RS232 port"

    "hi....
    I've ever controlled some instrument by GPIB interface using Labview 6.0...it's really easy to implement .....but the problem is that i hvae to control those instrument under the pure DOS environment now ..so i have to abandon the using of GPIB interface and Labview ....then i choose the RS232 interface with programing the Borland C++ v3.1 and sending the SCPI command by bioscom()....but it got no response at all......so i am wonder if i can control those instrument by using RS232 interface and Borland C++ v3.1 to implement a pure Dos program????if yse,how can i do and is there any sample can be refer to ????
    thank you for you help"

    Hello Alvin-
    We do not have any sample code for programming RS 232 in C on our website. However, you may want to looks at these links for general troubleshooting tips for serial:
    Serial Communication Starting Point
    How to Do a Serial Loopback Test
    Regards,
    Ray Kong
    NI Applications Engineer

  • Problems Reading/Writing Parallel Port Data, Status & control Registers Using In Port.vi and Out port.vi

    Hi,
    Can anyone there help me Please with the problem. I am trying to
    communicate with the parallel port using my program which i have
    attached to the message. I am running LabVIEW 7.0 Professional with
    application builder. All the program does is reads and writes to the
    three parallel port registers. It runs FINE!!! in my computer. But when
    i built an executable (see attached) and tried running on a different
    computer (with LabVIEW Runtime engine 7.0 installed) the program does
    not read/write to the registers. The target PC had the parallel port in
    SPP mode just like mine. I can't seem to understand whats going wrong?
    Can anyone please help me if you know the right answer.
    Thanks
    Attachments:
    Programs.zip ‏119 KB

    Hi Guys,
    I too have a problem using "Out Port.vi", but of a diferent kind. I use this VI to control the  Parallel Port which in  turn controls a small circuit. I use only two data pins, DP-2 and DP-4 for this purpouse. I use LV 7.1 Professional Development version in a Windows 2000 operating system. Now, my main problem is that my code runs fine (both is development and .exe forms) in my development computer, but when I try to run the .exe version in  other computers (Windows XP operating system), it asks for a "protocol file" while starting (look at the attached picture).
    Now, I really have no idea what kind of a protocol file it asks for and just click "ok" and proceed to work, the most interesting part is that the code works well as I expected. So, my only problem is that it asks for a protocl file which I want to avoid. As with the application building, I do all that is  required like including the sub VIs (self developed), creating an installer, enabling the port access, and creating a proper .ini fine. I also use the Out Port.vi from the AccessHW library.
    I have my doubts on two fronts,
    1) With the version conflict, since my development computer runs with Windows 2000 and my target computers all run with Windows XP
    2) With the Out Port.vi which further contains a small VI "Output Word to Port.vi" in it and that further contains Call Library Function Node, which might call soem external files, like what my problem is.(look at the attached picture)
    I don't have answers to these questions and may be my problem is in different place, but I would like to hear from anyone who could give me a helping hand. I am in a situation where I could not disclose my code.
    Thanks in advance,
    mohan
    Attachments:
    protocol file.zip ‏153 KB

  • Problem to talk to an instrument using rs232

    Hello,
    We are trying to communicate to a ROD-4 (instrument) by using an rs232 link. We have a program from rod-4 on pc and this communicates with the instrument(--> rs232link is OK I suppose) but we can't program everything we want. Therefore we will use Labview to communicate with the instrument(Rod-4). We have made a VI to communicate with the ROD-4 but it doesn't work. Do you want to check the VI I have made to communicate by rs232. Check also the rod-4 maual.pdf on pg 8 and 9, there is standing which program language the rod-4 knows (ascii protocol). The machine(rod-4) answers in the string read with:'' ?\n\r ''what dus this means?
    (Using win98se with Labview 5.1)
    Thanks.
    Attachments:
    Bureaublad.zip ‏101 KB

    One problem is that you're not sending the stx control character (hex 02). You're sending the text "s", "t", "x". I've attached a picture of a modified VI that should work. Note that I replaced the serial functions that you're using and used VISA commands instead. I'm also curious about something. You said you're using LabVIEW 5.1 but the VI you posted is version 6.1.
    Attachments:
    serial write.jpg ‏17 KB

  • Labview PDA using RS232

    Many new PDAs have USB cradles only. Can someone recommend a good configuration (PDA, OS and any options) that worked for Labview PDA to control instrument through RS232?

    I don't have a lot of experience with various PDA models but I'm using a Palm OS Tungsten T5 to do serial communication. I did have to buy a cable that converts the TTL level RS232 to as "true" RS232 level. Once I got that it worked rather well. As far as I know most Palm PDAs have RS232 coming out of there sync connector. You just have to do some digging or call the manufacturer to get the right info.
    Don't drive angry. Don't drive angry!

  • Capture Weigh Bridge Reading in ABAP Program through RS232 port

    Dear SAPers,
    I am in Cement Implementation Project and i have requirement to Connect Weigh Bridge to SAP ERP and capture the readings of that Weigh Bridge in ABAP program.
    How can i capture those readings in ABAP program or save them in a Z table using RS232 port????
    Best Regards,
    Kholoud
    Moderator message: please do not cross-post.
    Edited by: Thomas Zloch on Mar 17, 2011 1:22 PM

    Dear Vijay,
    I'm having the same problem in my implementation, the client needs me to capture the readings from Weigh Bridge through RS232 port directly to ABAP program.
    Could please tell me how did you solve this??
    Thanks
    Kholoud

  • How do I create Labview VISA ports for *individual* GPIB instruments using Prologix USB GPIB controller?

    Hello,
    I'm trying to use a Prologix USB GPIB controller to control GPIB
    instruments, and I would like to have a virtual serial (VISA) port for
    *each instrument*, as is the case with a normal GPIB controller with a
    standard NI driver. However this is not what the Prologix driver
    provides -- it provides a single VISA virtual serial port for the
    entire controller. To address the instrument with GPIB address 11,
    you first send "++addr 11" to the serial port, and then you're talking
    to instrument 11. However, this means I have to change all old
    Labview programs.
    Is it possible to create a "wrapper" function of some kind that will
    define a virtual serial (VISA) port for each *instrument* on the
    controller? For example, to talk to GPIB instrument 11, call it
    ASRL3::11::INSTR, each time it is written to it would have to write to
    the virtual serial port of the controller, say ASRL3::INSTR, first "+
    +addr 11" and then the command that is sent to it.
    A clearer explanation of the difference (i.e. incompatibility), and of
    my objective:
    1) A normal GPIB controller with NI driver: I go to the NI
    Measurement & Instrumentation Panel, under GPIB, and Scan for
    Instruments; all the live instruments show up; subsequently when I
    want to use Labview programs that use VISA ports, the VISA drop boxes
    allow me to choose a different port for each instrument, e.g.
    "GPIB0::11::INSTR", "GPIB0::12::INSTR" would be instruments at
    addresses GPIB 11 and GPIB 12.
    2) The Prologix GPIB controller that plugs into a USB port: In
    Labview you get a *single* VISA virtual serial port, ASRL3::INSTR, for
    the entire GPIB0 controller. Therefore to address GPIB instrument 11,
    you write "++addr 11" to the virtual serial port ASRL3::INSTR, and
    then you are communicating with device 11, so you can write and read
    ASRL3::INSTR to talk to that device. Then to talk to device GPIB 12,
    you write "++addr 12" to the same VISA port, and then you are talking
    to that device. The problem is that this requires recoding all
    Labview code, whereas I would like to be able to use the same program
    either with a normal or with a Prologix GPIB controller. Therefore, I
    would like to create code that scans the controller for all GPIB
    attached devices and creates VISA ports for all. Such ports, when
    written to, would have to first write "++addr DEVICENUM" to
    ASRL3::INSTR (i.e. the port of the GPIB-USB controller) where
    DEVICENUM is the GPIB address of the instrument corresponding to that
    port, and then would have to do a write or read or whatever function
    is being done on that instrument VISA port.
    I haven't figured out if it is possible to do this easily. Help and
    pointers on where to look for hints would be much appreciated. Many
    thanks!
    Milos

    My first impression is that if you don't want to make any changes at all to existing programs is that the wrapper you need is one around VISA. You would need to intercept all of the calls into the NI VISA driver. If you create your own visa32.dll and in there, change the addressing and then call the real VISA driver, you might (repeat, might) get something to work. If this would even work, you still might find that you have to make significant changes anyway. The serial connection is going to be considerably slower, and interface specific functions such as service request handling, bus triggering of multiple instruments, etc., would be difficult to impossible. This would be a lot of work, imho, to just save a couple of hundred dollars over a real GPIB controller. I've seen this Prologix device before and have even used NI's RS-232->GPIB controller. The Prologix intended use to me seems to me more for a hobbyist or very casual user. Of course, I'm used to having multiple GPIB instruments worth 10s/100s of thousands of dollars and the cost of an fully compliant GPIB controller is just lost in the noise.

  • Control a generator with a control volage by serial port RS232

    Hello everybody,
    I would like to control a generator thanks to a control voltage. This last one would be sent to a switch wich turns on the generator.
    To do that, I want to link the switch and the computer with a serial port RS232 by using NI-USN 232 cable.
    I made some research on this subject and I am only a beginner on LabView but I would like to use one (or several) pin which will send 5V in voltage when I want.
    Is that possible? Is there another way to make it?
    Thanks in advance.

    Thank you for your answer.
    Maybe, I didn't explain myself correctly. 
    For example, on the Raspberry Pi, you can control a card by sending 3,3V signal with RS232 port (I made it last year so it makes a sense).
    What I want to do here is to control an electronic card that turns on my generator after. I don't have enough to buy a generator controlled unless you know one not very expensive.

  • How to Control 1 bit on a RS232 port?

    Using VISA can read or write data from RS232 port,if I want to control 1 line on RS232 High or Low? Does any VI can do this? Thank you so much.
    Message Edited by shunshin on 03-22-2007 12:23 PM

    Which line do you want to control? If it's one of the control lines like DTR or RTS, then yes. You use a VISA property node. Select Properties>Serial Settings>Modem Line Settings.
    Message Edited by Dennis Knutson on 03-22-2007 11:31 AM
    Attachments:
    Modem Line Settings.PNG ‏2 KB

  • Control Temperature of WATLOW using RS232..Got vi ? to begin with?

    Looking for vi which can help me conrol the temperature inside my little chamber (WATLOW) using RS232 port

    If you are looking for generic serial example programs, go to Help»Examples»I/O Interfaces»Serial»LabVIEW<->Serial. Enter the com port and set both dip switches in the up position.
    If you are looking for a instrument specific driver, you may want to contact the manufacturer to see if they have a LabVIEW driver for their instrument. If they don't, you can easily create a low-level driver by configuring an I/O assistant VI for each function in the manual. I/O assistant is one of the many new features of LabVIEW 7 and will parse instrument responses for you, which makes creating an instrument driver much easier. Once you have this low level driver you can just combine functions to make higher level VIs.

  • Using multi threading to access 2 RS232 ports

    Hi,
    I'm a beginner in multi threading, so this question may be a very basic one....
    I'm Using TS3.5 + CVI 8.01 to communicate withs 2 RS232 ports.  I thought to use mult threading so I can process 2 steps in parallel rather than in series. 
    This is what I do:
    1) I defined 2 subsequences, each of them call the same CVI function.  I use the sub sequence parameters to transfer the com number.
    2) My CVI application includes one dll for this specific project and another one, a general dll to handle RS232 functions.  The RS232 dll uses one global buffer than collects all the traffic on the com. 
    QUESTIONS:
    1) What happens when 2 seperate threads run the same function in the RS232 dll?  (in terms of memory etc...).  Does each one use a different buffer (in terms of memory allocation), or, both of them writes to the same buffer?   Obviously, if they writes to the same buffer, then, my function will not operate properly.
    2) What happens in TestStand after the 2 steps in new threads have finished their execution?  does the next step run back in the same threads the sequence run before?
    Thanks
    Rafi

    Rafi,
    Glad to hear you were able to make some ground on your application. As for all of your questions, I'll try to answer as many as I can.
    First, when you are talking about your global buffer, is it created in TestStand or in the DLL itself? When you use DLLs, global variables or global structures are shared between all threads that call your DLL. On the other hand, if your buffer is declared inside of the DLL it is global for the DLL but not shared and would be a separate buffer for each call.
    With your run-time error in TS, it would definitely be helpful to have more information about the error. From what you explained (executing fine on the first call, but failing on future executions), it sounds like the resource is not being released after the first execution.
    As far as a specific example for TestStand Multithreading, you'll want to look at the TestStand Development Library and, specifically, Multithreading in TestStand. If you look and browse through the Application Notes and Tutorials section, as well as the Technical Presentations section, you will learn a great deal about multithreading and what options you have in TestStand. For a specific example, you may want to look at This Example. You could also look in the <TestStand>\Examples (where <TestStand> is the directory where TS is installed) at the MultiUUT example for an example of multithreading in TS. These examples may not be exactly what you need, but they should give you a jump start.
    As far as making your DLL multithread safe, it is definitely not necessary; however, there are some significant advantages described in this article: Designing Thread-Safe DLLs. It is an MSDN article that focuses on Visual Basic, but it has some helpful information that can apply to C as well.
    Hopefully this can help you move further. I have attached a list of links at the end of this post with other helpful links for you as well. Keep us posted with your progress.
    Matt Mueller
    NI
    Links:
    General Information on Multithreading for C Programmers
    Building Multithreading Applications with LabWindows/CVI
    Multithreading in LabWindows/CVI
    Easy Multithreading Programming in LabWindows/CVI
    Multithreading for Rookies

  • Why can't I read from a device on my RS232 port

    I am attempting to write and read from a device on my computer's RS232 port.  I attempted to use the Basic Serial Write & Read.vi example in 6.1 with no luck(I have also attempted to use the other serial examples with no luck).  My application attempts to write a command to this device on the RS232 port and then read the response back from the device.  Everytime I run the vi I receive a timeout error. It seems the timeout is occuring during the read portion.   I have used another application(MTTTY) to send and recieve RS232 messages back and forth to this device, so I know the port and device are working.  I have entered the same port settings I am using in the MTTTY application into the vi still with no success.  One more thing, after I run the Basic Serial Write & Read.vi example, my other application can no longer read & write successfully to the device on the port.  I need to power cycle my device before my MTTTY application will again be able to communicate successfully.  Anyone have any ideas on what is going on?

    I'm not familiar with the MTTY program but your problem is extremely common and usually the result of not sending a termination character at the end of the command string. Most serial instrument require this and it's usually a carriage return or line feed character. In the LabVIEW example, right click the string control where you are entering your command and select '\' Codes Display. Type a \r (carriage return) or \n (line feed) or a combination of both, at the end of the command. Your instrument manual should tell you exactly what is required.

  • Problem in using serial port.

    I am using serial port to get data from a fusion splicer. The number of bytes at the port is 4096 but the read buffer of VISA read is empty. I am reading the same number of bytes. Can any one tell me what is the maximum size of VISA Read buffer? I am trying to put the contents of the buffer in a file. I am using labVIEW 6.1 on linux.I am also attaching the VI.
    I also noticed this problem...If I read the number of bytes in the serial buffer many times, sometimes it reads it as 0 and I have to keep trying until it reads this 4096 bytes.
    Thanx for any help.
    S.Vijayalakshmi
    Attachments:
    serail_comm.vi ‏52 KB

    Hey Viji,
    In your application it looks like you are just checking to see how many bytes are at the serial port. Is it possible that your application is check for the serial data at the port before the data actually gets there. If you are looping this code as a subVI or just running it over and over it is possible that one of the iterations could occur faster than your device can write the information to the bus. In this instance you are checking the number of bytes at the port and there might not be any there yet. In this case the port reads 0 as you have designed it.
    If you want the read function to wait and always read 4096 then don't wire the bytes at port to the read function. Just wire a constant/control equal to 4096 to the read function instead o
    f the bytes at port. In this case, if there are not any bytes at the port the read function will wait for the bytes to show up or until the timeout period is reached.
    I would also, suggest lowering your time to something more reasonable, because if your instrument quits transmitting your application is going to wait for 33 minutes. That is a long time for a program to hang.
    I hope this helps out.
    JoshuaP
    National Instruments

Maybe you are looking for

  • Purchase Info record - ALV standard report

    Hi, Is there a standard transaction or report or some other utility program to get the purchase info record in excel format? I see ME1M and other standard transactions, but they doesn't come in one line report. I wanted to download the records in exc

  • Windows 7 with latest AirPort Extreme

    I have just bought the latest AirPort Extreme. Set-up using airport utility on all my apple products worked like a charm. I then installed airport utility and updated it in my old windows 7 laptop. - airport utility on windows 7 cannot detect the wif

  • Accessing JSP Variables in Custom Tag Handler.

    Hi, I am creating a custom tag which builds a list view. I have certain String array in my JSP and I need to pass the same into my Tag Handler class. I tried following ways : 1. In doStartTag() implementation I used    public int doStartTag() {      

  • Bapi And IDOC

    Hai,   is it possible to use BAPI's in IDoc 's Instead of DATA conversion method? Which bapi is for populating Invoice in idoc? Thanks Avi

  • HT3777 Once I make a Windows partition can I make it larger and if so how?

    I made a boot camp partition for windows 7 pro but now I want to increse the size of the partition. Can I do that and how?