USB with LABVIEW / VISA

Hi all,
I am a beginner in Labview. I had to develop a small prototype to read data from RS232. With VISA's functions and labview examples, everything worked fine.
Now I would like to interface some USB devices by using similar VISA's components. In order to acquire skills in USB programming, I would like to build a simple program which for instance would get information on a simple USB device (as a USB KEY, or a USB mouse...).
I already succesfully created specific visa drivers with the drivers wizard, installed them, see them with MAX.
I studied the LV examples USBRawControl.VI and USBRawBulkMain.VI. But I do not succeed in getting any results. I guess I enter the wrong parameters in the example. Can anyone explain me a bit more how it works ? Or give me a set of parameters to test the LV example and get any results ?
Thanks a lot.
Jérémy

No, there is no international standard in order to get/receive data from a USB device. That's exactly the problem. How the vendor implements a USB serial adapter could be completely different than implementing a USB storage device.
You would need to ask the vendor about the data transfer mechanism - i.e. bulk or control pipe. Bulk is probably the simplest since you can just use a VISA Write or VISA Read so you would need a list of the commands to send and how the received data is formatted. This is what I used and since we wrote the firmware for the USB device, it was fairly simple. Look at the shipping example called USB - RAW Control to see how much information you need to read/write with this mechanism. If you got this to work, you would still need information on how to translate the control buffer data. I've never had to formally request this but you misght want to search the forum for posts regarding USB RAW to see if you can find more information.
If you are getting a commercial sensor, then it is very likely that they have a dll available that can be integrated into multiple programming environments. In most cases, this is a much better solution than trying to develop your own VISA driver.

Similar Messages

  • Communicating USB using Labview VISA

    I have a USB RAW device that I am trying to communicate with using labview VISA. I have had success with setting up the driver and I am able to get information from the device such as serial number, etc. When I try to use the VISA read and write commands, I have no success getting the information I want. The commands are simple: R SP<CR><LF> is a read set point command. The only thing I do get back for every command I try, is a 2 byte message "01 60"hex.
    If you have any suggestions, I would appreciate it, thanks!
    [email protected]

    Hello Chris, I do not receive any errors and yes, I am including the termination characters in the string.
    Here is what I get when I use a USB port monitor when I send out this string.
    Thanks!!
    [94] URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER (SUCCESS/0x00000000) 20101119150318.131 (+0)
    Pipe handle: 0x87696D6C
    Transfer flags: 0x00000002 (USBD_SHORT_TRANSFER_OUT, USBD_SHORT_TRANSFER_OK)
    Transfer buffer MDL: 0x88C47208
    Transfer buffer length: 6
    Bytes transferred
    0x0000: 52 20 53 50 0D 0A (R SP.. )
    [94] URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER (SUCCESS/0x00000000) 20101119150318.147 (+16)
    IRP status: 0x00000000 (STATUS_SUCCESS)
    Pipe handle: 0x87696D6C
    Transfer flags: 0x00000002 (USBD_SHORT_TRANSFER_OUT, USBD_SHORT_TRANSFER_OK)
    Transfer buffer MDL: 0x88C47208

  • Ant+ USB with LabVIEW

    Hello. Has anyone attempted to read sensor info via Ant+ USB into LabVIEW? I have some code that sort of works... regardless of whether I use the Dynastream provided driver or create a VISA driver using VISA Driver Wizard, I get the following errors in the LabVIEW VI "VISA Open":
    "The specified VISA resource is not a USB device"
    "Error -1073807346 occurred at VISA Open. Possible reasons: The given session or object reference is invalid."
    I've tried using both "VISA Defaults" and "Load Configured Settings" for the "access mode" of the resource.
    Any insight would be appreciated. LabVIEW code is attached. The main program is "Ahad_Vectorfinalpstruct_JFA" in JFA_Mod\Jamie.
    Thanks,
    -Jamie
    Solved!
    Go to Solution.
    Attachments:
    JFA_Mod.zip ‏151 KB

    Hi jfalesi,
    This is Roel in Applications Engineering at NI. Some more information about your project might be helpful in assisting you. Are you able to see the device in NI Measurement and Automation Explorer (MAX)? If so, have you done a self-test? If yes to this also, try using the VISA test panels to interactively communicate with your task. Before troubleshooting code, it is best to follow these steps to ensure that the computer can indeed communicate with the resource.
    Best of luck!
    Best Regards,
    Roel F.
    Applications Engineer
    National Instruments

  • Can I programmat​ically control USB with LabVIEW?

    I have a requirement to test a USB device. The test includes powering several of the devices off and on, i.e., power cycling for several hours. My plan is to accomplish by using a USB hub, breaking out the power circuit and running it through a relay inside of a DAQ. A neater solution would be to programmatically turn the USB device off and on. I know that the computer communicates with the device under test via USB and not the USB port itself. So I’m wondering if it’s possible with LabVIEW to accomplish this.
    Thank you.

    I'm not exactly sure what Eric was referring to as far as ActiveX. If it's with respect to the operating system, you're not going to find any ActiveX interface with the OS to do this. Unless he was referring to software programmability of the hub? Don't know.
    With respect to power-cycling, a USB port can be disabled using OS calls. Thus, if you want to just turn off the whole hub you can disable the USB port that the hub is connected to. On Windows you can use a command-line utility called devcon to do this (search the forum as this has been mentioned before). The limitation is that devcon is not redistributable. This means that you cannot include it if you're giving this software to a customer. If, on the other hand you need to selective turn off the ports on the hub (i.e., to test individual devices), then you'd have to go back to the manufacturer of the hub and find out if they have a software interface to do this. Otherwise, it's the external power on/off approach via a relay or via a regulator as suggested by SnowMule.
    EDIT: Additional caveat: devcon may not work under Windows 7. You did not indicate what operating system you're using. However, the OS calls that devcon makes are still there.

  • Comiucation computer usb with labview

    Hi
    I want to communicate us computer with labviwe but I don't know how can I do it?
    Can you tell me please how can I communicate between computer usb and labview?
    Thanks you .

    The USB interface on the pcb has to be implemented by something. Do you have a microcontroller, or something like that? If you don't know much about USB communication, then this will be very difficult for you. In addition to the KB article I mentioned before, it would be worth your time to read this nugget: http://forums.ni.com/ni/board/message?board.id=170&thread.id=340676.
    If you haven't implemented anything yet in hardware, you may want to consider chips like those sold by FTDI which can provide a virtual COM (serial) port interface for applications via their drivers.

  • OBD1 ALDL communication with Labview VISA

    Hello all,
    I am new to serial communication with labview.
    Task:
    trying to send a command and receive data from a 1987 corvettes ECM using VISA serial block in labview.... and failing hard
    Troubleshooting the problem:
    Hardware: works with EFI live V4 (software that communicates with cars), send and receives data all day long, so my hardware is not the problem
    software: it is something i am doing wrong in my coding
    Example code form EFI live V4:
    37:30.137: Send: $80,$57,$01,$00,$28
    37:30.137: Finished writing frame
    37:30.137: Wait 10 ms after writing, before reading...
    37:30.147: Start reading frame
    37:30.147: Aldl frame header byte: $80
    37:30.147: Aldl frame length byte: $57
    37:30.147: Recv: $80,$57,$01,$00,$28
    37:30.147: Finished reading frame
    37:30.147: MAX232 echo: $80,$57,$01,$00,$28
    37:30.147: Wait 10 ms after writing, before reading...
    37:30.157: Start reading frame
    37:30.160: Aldl frame header byte: $80
    37:30.160: Aldl frame length byte: $95
    37:30.241: Recv: $80,$95,$01,$1E,$5B,$00,$00,$00,$00,$00,$44,$44,$1D,$00,$9C,$D6,$00,$00,$FF,$66,$00,$80,$80,$00,$80,$64,$80,$FF,$00,$80,$00,$27,$27,$00,$00,$00,$77,$00,$3A,$00,$43,$00,$00,$00,$00,$00,$00,$00,$00,$01,$BD,$00,$00,$00,$00,$00,$00,$D5,$2A,$22,$00,$07,$00,$00,$0C,$00,$DE
    37:30.241: Finished reading frame
    Example code protocol i tryed into the visa block in labview:
    $80,$57,$01,$00,$28
    $80,$57,$01,$00,$28\n
    $80,$57,$01,$00,$28\r\n
    $80$57$01$00$28
    $80$57$01$00$28\n
    $80$57$01$00$28\r\n
    80 57 01 00 28
    80 57 01 00 28\n
    80 57 01 00 28\r\n
    8057010028
    8057010028\n
    8057010028\r\n
    VISA read Result:
    i just get an eco back of the same command i sent
    Question:
    is there something simple i am missing in the command protocol or a possible setting i am overlooking?
    also what is the purpose of the “$” in the Hex command?   
    background info:
    vehicle : 1987 corvette
    ECM type: 16198259
    com. protocol : ALDL OBD1
    labview v8.5
    baud rate: 8192
    data: 8 bit
    parity: none
    stop: 1
    buffer size: 256

    Are you actually supposed to be sending hex? You need details on the actual format of the data. I don't think viewing the output of some other program will tell you what is truly being sent and received unless its a sniffer such as portmon.
    You can right click on the string control and select hex display. You also did not include the actual VI so no one knows if you have it set to send \r and \n correctly.

  • Can i control a digital photocamera trough the USB with Labview

    i want to control my digital photocamera with labview, so that i can take a picture on a labview command.

    NeoVista (www.nvsi.com.au) has an excellent toolkit for controlling Kodak digital cameras - maybe they could help?
    Copyright © 2004-2015 Christopher G. Relf. Some Rights Reserved. This posting is licensed under a Creative Commons Attribution 2.5 License.

  • Usb with labview

    First of all sorry for my English. I would like to use labview for comminication with microprocessor. Until now iI'm using visual basic for this, specifically HID, not DLL. Do you know how can I use HID in labview?
    Thank you very much

    Hello,
    which is exactly HID? Is that a set of functions for Visual Basic to program microcontroller?
    To get started about LabVIEW and USB communication, you can see the following link:
    http://digital.ni.com/public.nsf/websearch/42B604435E3F9604862565E20043CD30?OpenDocument
    Inside, there is another link to Using NI-VISA to control your USB device
    crisR

  • Using SignalExpress with LabVIEW VIs

    Hi everyone,
    a short question about interaction of SignalExpress and LabVIEW: does the integration of LabVIEW Code work although LabVIEW is not installed? I may have an application where users need to use some VIs in SignalExpress but they don't need to edit them. So it would be nice not to have too spend the money on antoher LabVIEW license.
    Cheers
    Oli
    Programming languages don't create bad code, programmers create bad code....

    Hi Oli,
    take a look into Knowledge Base Entry 3LAGNBL2: http://digital.ni.com/public.nsf/websearch/F6D5EF4620EE12EB86256FFE007D2086?OpenDocument, it tells you the requirements for doing that.
    Furthermore you will find useful information about creating these steps in the following docs:
    http://zone.ni.com/devzone%5Cconceptd.nsf/webmain/5A807DFBE89D7EAD86256ED30008D88A/$File/WP2466.pdf
    http://zone.ni.com/devzone/conceptd.nsf/webmain/B19A4046EADBFA6C86256EE90078C35E
    Hope it helps!
    Good luck programming your plug- ins and kind regards
    Stefan
    Impossible is nothing - nothing is impossible

  • Device works fine with MAx but not with Labview visa serial

    I have a Monarch rpm sensor hooked up to Monarch tachometer , it gives error while coding in labview and works fine in Max if the sensor doesn't read 0. I have written simple RS-232 programs never had an error but this one is giving errors ..not ablt to fix it..please help
    Solved!
    Go to Solution.

    No device can actually measure a speed of zero.  It can only specify that the speed is less than some minimum, which depends on how long you are willing to wait for an answer.
    I do not know anything about your instrument, but I would guess that you are getting an error which is the equivalent of "The instrument has waited the maximum permissible amount of time and did not detect any measurable motion."  This is the instrument's way of saying that the speed may be zero, or very slow, or something is broken so that it cannot make a measurement but it cannot detect the problem.
    Look at the manual for you instrument to see how it responds to the zero speed condition.  This error may be normal.  If so, you need to capture the particular error code and handle it however you think is appropriate.
    Lynn 

  • Usb Data Write in Mcb 2300 with labview

    Hi
    I have mcb2300 board.I want to write datas in usb with labview.How can ı do?
    Thanks for answer...
    Himmet GENCER
    Software Development Coordinator at Teknik Destek Grubu
    [email protected]

    Hi Himmet,
    Here are some examples and documents which may help but you are going to have to use C to program that USB communication through Keil
    http://forums.ni.com/t5/LabVIEW-Embedded/How-to-use-USB-interface-with-LabVIEW-Embedded-for-ARM/m-p/...
    http://digital.ni.com/public.nsf/allkb/1416FED9DA9F212F862576EB0075EDD6?OpenDocument
    http://digital.ni.com/manuals.nsf/websearch/956FF9313C8390E3862574CD00546682
    I hope this helps!
    Sam S
    Applications Engineer
    National Instruments

  • Can i communicate with labview, using ethernet or seriel modbus.

    Is it possible to communicate with a i/o module and labview. I can communicate with ethernet, canbus(cscan, devicenet), rs232(modbus).
    What is the easiest solusion.
    Is it necessary to buy PC-cards for the communication or have only to download some drivers.
    Thx

    Hello,
    To communicate with a CAN/DeviceNET bus you will need an interface card in your PC. NI has such cards along with LabVIEW VIs:
    http://sine.ni.com/apps/we/nioc.vp?cid=1329〈=US
    http://sine.ni.com/apps/we/nioc.vp?cid=1311〈=US
    To communicate with Modbus, you will NOT need any special cards but you do need software drivers for it (you'll obviously need an Ethernet card for TCP/IP and Serial port for RS232). There are several options for these drivers, however:
    1. Write your own driver VIs. You'll basically implement the Modbus protocol in LabVIEW. Modbus is a simple and open protocol.
    2. Try to search the Net for such existing VIs. I believe someone has already written such Modbus VIs.
    3. Use the Industrial Automatio
    n OPC Servers suite from NI:
    http://sine.ni.com/apps/we/nioc.vp?cid=4584〈=US
    4. Use any third-party OPC Server for Modbus.
    NOTE: in case you opt 3 or 4 above: though you may use DataSocket in LabVIEW as an OPC Client, you may want to consider LabVIEW-DSC which has a built-in OPC Client, and hence better support for OPC.
    Hope this gives you some options.
    Regards,
    Khalid

  • Error in ni visa control out for usb in labview 2009

    Hi,
    I am using labview 2009 in which i have made a vi which communicates with a pic controller through USB interface.
    the vi is working fine in labview 8.6. I tried it in two PCs. but when i run that vi in a PC with labview 2009 then the VISA CONTROL OUT.vi gives error "0xBFFF003E : Could not perform operation because of i o error.". while the control in.vi works fine in both the labview versions and any other PC that i tried.
    I have run the application in total of 4 PCs with same set of cards/interfaces. two of them having labview 8.6 are running fine and giving no error but other two with labview 2009 are giving error.
    and it doesn't stop here.... i searched in the vi and did some experiment and found that when i give Request value input to control out.vi as "0x36 "(as required by my PIC program) then it is giving error but when i give other value such as " 0x35 or 34 or 55"(used for other purpose) then it is not giving error.
    Can it be a PIC programming problem? (i dont think so as everything is fine in other PC with LV 8.6)
    I have already explored the ni forum for this error solution but could not find helpful.
    Can anyone solve my problem?

    I installed labview 8.6 in that machine and made a small program with only 3 vis (visa open session, visa close session and visa usb control out.vi) which is working in LV 8.6 platform.
    Sorry the above statement is not correct actually.
    When i run the program in LV 8.6 it giving that same error but this time it is not displayed as pop up window. so i could not judge that error was still there.

  • How to communicate with HID USB device under windows XP with Labview

              I have designed a EZ-USB FX2 device and I need to communicate with LabVIEW. I mean I just want to send and receive data. I don’t know how to achieve this goal.Someone have advised me to design a HID device,then use VISA Driver Development Wizards to generate driver(inf file).SO I defined it to a hid device .However when I connect my hid device to the computer, it will automatically be recognized as HID compliance device. I can’t to install the inf file driver. I wondered whether all HID devices will be acquiescently installed the drivers contained in the windows rather than use the inf file driver generated by VISA Driver Development Wizards? If so,what should I do next to communicate with HID USB device under windows XP with Labview? HOPE TO GET HELP!
              KIVI

    Hi,
    I am working on a project using PIC18F4550 MCU and USB.
    I would need to send and receive data from the MCU thru USB. I have uninstaled the HID and created a new NI-VISA driver for my MCU. this worked fine, and it did showed up in MAX
    Unfortunately I was not able to receive data from the MCU, Just sending!
    I thought to use HID.DLL but the way I need to use the functions inside the HID DLL is simply too much for me, I am not a PC programmer.
    There is any kind of VI that is able to use HID.DLL to comunicate with external devices conected to PC thru USB?
    Please Help
    Andrei

  • Looking for a way to get my Product ID and Vendor ID so I can enable my Radium 49 USB MIDI keyboard to work with Labview 7

    Looking for the Product ID and Vendor ID for my Radium 49 USB MIDI keyboard to work with Labview 7
    Is there a tool to find out the Vendor ID and Product ID for a USB device?
    Example: of what I'm looking for
    The Product ID for National Instruments DAQPad-6020E is 0x12C0. The
    USB vendor ID is 0x3923. This is a 16-bit hexadecimal number(1093)
    (that is decimal 4243).
    Thanks for all the fast responses this newsgroup RULES!!!!!!!!!!!!

    http://digital.ni.com/public.nsf/allkb/335A90747734097886257070006415B9
    How To Find The Vendor and Product ID for USB Devices?
    Primary Software: Driver Software>>NI-VISA
    Primary Software Version: 3.3.1
    Primary Software Fixed Version: N/A
    Secondary Software: N/A
    Problem:
    I want to make an NI-VISA driver that requires the vendor and product ID?
    Solution:
    There is a utility called USBView,
    free from Windows, attached below, which you can use to view what is
    connected to your computer's USB ports. It is necessary to load this
    program and connect the USB device in development. Upon selecting the
    device in USBView, one can then look on the right side of the
    application window to obtain the Product ID and Vendor ID. This will
    allow you to enter in the correct IDs when creating a driver .inf file
    when using the VISA Driver Development Wizard. For more information
    about how to use the VISA Driver Development Wizard see the related
    links below.
    Note: It is necessary to keep the hexadecimal
    (0x####) format. Do not remove the "0x" hexadecimal format preceding
    the ID number. 

Maybe you are looking for

  • Fifth Gen Video to TV issue

    I purchased an iPod AV Connection Kit and I read and tried all the suggestions but I am still not receiving a video signal. So I used an S-Video cable and still no signal. I tried it on a fourth generation iPod and that did receive a video signal, on

  • Word 2010 VBA - Global Variables in VBA and using them in VBA Code

    Hiya I need some help.  I have the following code that takes a word document, converts it to pdf and saves it to the local temp folder and attaches it to an email.  Up until now the filename for the file has been hard coded. I have now created a user

  • How to Copy Excel table into CS4 and print onto photo in sequence.

    I would like to be able to import fields from Excel into Photoshop CS4 and have the Excel information print directly onto the photo image as a line of text across the bottom and layered over the image itself.  This Excel information needs to be able

  • How to install lan card in solaris 11

    Hi, can some one please tell me how to install lan card in solaris nevada snv_55b X86, 5.11 When i do ifconfig -a it only displays loop back driver only lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1

  • WLP 4.0 w/ Red Hat 6.1 sp2

    I can't seem to find a SP1 version for Red Hat. Can someone verify that SP2 will operate with WLP4.0? As of last week, the NT version of WLS6.1 w/ SP2 would not. Thanks.