LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Error when using example code - "due to attributes being set to an inconsistent state"

HI,

I have been trying to use the attached example code on my laptop, and it errors suggesting it's "due to attributes being set to an inconsistent state". I do not get the error when using the same code on my desktop PC. I have tried various serial port initialization setting but all has failed to get rid of the error. I am trying to set the DTR & RTS lines, the code does this then errors - Any ideas?

Thanks / Martin.
Certified LabVIEW Architect
Message 1 of 7
(4,570 Views)
Hey!

I have one big question for you - do you have problems doing the same types of things with NI-VISA on that laptop? I worked with a student this past December who was trying to get LabVIEW to control Christmas Lights using NI-VISA over a serial port for several days. We kept running into the same roadblock on a laptop being used for the project, the "attributes ... inconsistent state" type errors when attempting to communicate with the specific serial device. We eventually blamed the problem on how Win2K was installed on the laptop - the laptop originally had Win98SE, and then the OS was "upgraded" from 98 to 2k instead of performing a fresh install. Somewhere in the upgrade something went fuzzy and resulted in a mess. When the laptop was wiped clean and a fresh install of Win2K was performed, the code worked as beatiful on the laptop as it did the desktop.

I don't know how similar the two problems might be, but Good Luck!

-Danny
0 Kudos
Message 2 of 7
(4,547 Views)
Hi Danny,

Sorry for the dealy in responding to you - I have been away installing a machine...

I have been using VISA on XP (LV7.0 & 7.1, medion laptop). What you explain worries me, I was hoping there would be a more simple solution. But thanks for sharing your knowledge. I have since found that writing to the DTR is OK but the error (-1073807302) is generated when tring to set the RTS line. I planning on trying connecting some of the other pins together to see if that helps the UART logic. My application will be installed on various different computers and O-Systems so I'm looking for something that I can rely on. Maybe I should try the Inport / outport functions, or the old serial VIs (serp...), or maybe different versions of VISA (I'm using version 3.0). Any experiences or example code would be much appreciated. Now I can control the DTR line all I need is power from the port (+ve voltage) maybe there is another line that is always logic high and I need not control it at all? I'll share the souloution when (if) the problem is ever solved.

-Martin
Certified LabVIEW Architect
0 Kudos
Message 3 of 7
(4,516 Views)
This is just a shot in the dark. In the example you posted, your are not configuring the serial port. Could it be that the port is set for some handshaking mode and that's the reason VISA won't let you set the RTS line?
Message 4 of 7
(4,508 Views)
HI,

I have tried just about all combinations of serial port initialisation, none have fixed my software error. Since I can control the DTR line without an error I can just about get the control I need. But it's a poor implimentation - I initialise the serial port on every iteration, control the DTR line, and ignore all errors just incase they are generated. I'm hoping by initialising on every iteration that the RTS line is always set high (+15) across a wide range of PCs that I do not have the luxury of testing first. I still have lots of things to try before I resort to this poor implimentation. I'll keep you posted.

Thanks / Martin
Certified LabVIEW Architect
0 Kudos
Message 5 of 7
(4,484 Views)

Well - in my last post I did say I'll keep you posted, it only took me 2 years to get around to it!

I gave-up with VISA and used a great API that you can download form here http://www.mhst.de works very well, not one issue encountered.

Note that I have not tried any version of VISA for serial line control for the last 2 years - well why would I?

-Martin 

Certified LabVIEW Architect
0 Kudos
Message 6 of 7
(4,244 Views)
Hi Martin,

Your example VI runs fine here with the latest NI-VISA, version 4.1. 

The NI-VISA API is supported on many platforms including Windows, Mac, Linux, Real-Time, and PocketPC, and it supports all of the standard instrumentation buses including serial, GPIB, TCP/IP, VXI, PXI, and USB.  If you are interested in setups other than serial in Windows, NI-VISA is probably your best option.

If anyone else wants to run the posted example VI, please use the latest version of NI-VISA.

Gavin Fox
Systems Software
National Instruments
0 Kudos
Message 7 of 7
(4,214 Views)