LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Create new instrument I/O vi from template "read and display" not working

I viewed the "New Tools for Instrument Driver Development with LabView 8" tutorial and tried the "Instrument Driver VI Creator". First off, with version 8.5 it's a little different. Rather than selecting "New > Instrument Driver VI"  we select "New > VI > From Template" then I selected "Instrument I/0 (GPIB) (but I'm using serial) > Read and Display".
 
I configured the Instrument I/O Assistant, and it reads and parses my instrument correctly. But when I run it, nothing comes out of the "token" output port. NI Spy shows that the command and responses on the serial port (COM 1) are being sent and received correctly. Why isn't this vi working?
 
My vi is attached. (I can't seem to insert a png screen shot of my block diagram. When I click the "Insert an Image" icon it wants me to enter the URL. If I put the full path to my png file, it just puts a generic icon and not the image. Am I doing something wrong?) -- (I thought I saw posts with the image in them, but I guess they are just attachments.)
 
Thanks all.


Message Edited by Edjsch on 05-23-2008 11:11 AM
Download All
0 Kudos
Message 1 of 8
(3,344 Views)
I just want to mention that the "Basic Serial Write and Read vi" method (the "hard" or "old" way) works fine. I am just testing the capability of the wizard.
0 Kudos
Message 2 of 8
(3,321 Views)

You mean you want to test the Instrument I/O Assistant? The instrument driver wizard is something completely different and is available from Tools>Instrumentation in 8.5.

I don't understand why the assistant is not returning the token though. Do you have automatic error handling turned on or off? If it's off, turn it on or connect an error cluster to the assistant's error out to see if there is an error being generated. The other thing to try is to convert the assistant to a VI by right clicking on it and select Open Front Panel. You can step into it and use the debug tools (i.e. probe) to see what might be wrong.

0 Kudos
Message 3 of 8
(3,316 Views)

I thought the I/O Assistant and the Wizard were one in the same based on the video tutorial, but I see that they are not. I looked for and found the VISA Driver Wizard from the Windows Start button. However, it doesn't have Serial, only PXI/PCI, USB, and FireWire. Do you know why?

Anyway, back to my Instr_Read I/O Assistant example. I didn't turn the automatic error handling on or off. I assume it defaults to ON. After I posted my question, I did try wiring the Error Out to an indicator, and it shows no error. However, this morning, I experimented some more. If I select another COM port to which my instrument is not connected, it returns error code 0xBFFF0015. This is a timeout error, which makes sense. When I switch back to the proper COM port, the error goes away, but still I am not getting the token output.

I decided to debug further and converted the I/O Assistant to a vi. Internally it's working (I probe various points). The problem seemed to lie in the Match Pattern vi. Its input is correct, but no output. I changed the Pattern Match string which was [,;\r\n\t]+ and got it to work. Then I closed the vi without saving, and re-opened my example. I double-clicked the I/O Assistant and changed the Character Count to be "To End of Data" and it now works. Previously, it was a specific number (10) before based on the string returned in the Assistant, but I guess it doesn't account for the 2 termination characters, so the real string length is 12 (but it only let me make it 11 giving me an "overlap" error message). Then I can see the token, but I had to expand the indicator box vertically because of a leading \n (LF).

I guess the lesson is that with any "wizard" or "assistant" there are still configuration and/or useage problems which can be more time-consuming than doing it from scratch yourself.

Thanks Dennis very much for your reply. Till next time...

0 Kudos
Message 4 of 8
(3,284 Views)

Glad you got it to work. I've never used the Instrument I/O Assistant for any real work and I'm not surprised that there are slight modifications you might have to make.

The VISA Driver Wizard is a completely different animal than the instrument driver project tool. The VISA Driver wizard allows you to create windows inf files so that USB devices and PCI cards can be recognized as VISA devices in windows. The instrument driver wizard should be under the tools menu. What version of LabVIEW do you have?

0 Kudos
Message 5 of 8
(3,278 Views)

I have version 8.5. I do see it in the Tools menu under "Instrumentation > Create Instrument Driver Project". I was expecting to see it in the Getting Started window, which was how I initially picked "VI from Template" (similar to the "File > New..." menu item).

After creating the Instrument Driver Project, it opens up the Help item "Instrument Driver Modification Instructions". Searching the Help more, I found:

Using Instrument Drivers

An instrument driver is a set of high-level functions that control and communicate with instrument hardware in a system. In LabVIEW, an instrument driver is a set of VIs that communicate with an instrument using LabVIEW built-in VISA I/O functions...

So I need to read up a little more on just what NI calls a "driver". I assumed it is as stated above -- just vi's to communicate with an instrument. Your definition seems to be more along the lines of Windows (or any OS) hardware driver files (*.sys in Windows). Thanks for pointing this out to me! This is how one learns!

0 Kudos
Message 6 of 8
(3,272 Views)
The confusion is that there are multiple types of drivers. The instrument driver is just as you explained. The NI-VISA driver wizard creates a low level windows device driver. After you create a device driver, then you would go and create an instrument driver.
0 Kudos
Message 7 of 8
(3,258 Views)

Thanks for the clarification and elaboration!

0 Kudos
Message 8 of 8
(3,253 Views)