LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Remote Control for an External Instrument

Hi Steve,

The error you mentioned means that you currently have the serial port open with another application. (You can only have one session open to the port at one time) In your case, I am suspecting that you still have the VISA Interactive control window open from MAX when you try to use the I/O Assistant.  Please verify that the VISA Interactive Control Window is closed. Also, there is a shipping example  (Help>>Find examples) that you should find helpful. It's called "Basic Serial Write and Read.vi", and you can find it in the example finder under Browse>>Hardware Input and Output>>Serial. What it does is send the *IDN? command to the instrument, and read back the response. You can put the VISA Write and Read VIs in a while loop, and send all your commands to the instrument. Hope this helps. Post back if you have further questions. Thanks!

Regards,


Message Edited by _Belle on 11-30-2006 12:01 PM

Ebele O.
National Instruments
Message 11 of 16
(1,182 Views)
Hey Belle,
 
I did have the VISA Test Panel open by mistake, in turn giving me the errors.  However, I just realised the Instrument I/O Assistant won't "get along" with the techs in the lab who will be testing it all so I'm going to utilize the while loop like you suggested.  I do have a few questions regarding this though...
 
I have 12 commands to enter, should I put them all into an arry of strings, or should I create a Stacked Sequence/Flat Sequence and then feed them into the while loop.
 
The commands I have are, in order: Readout Tranmisttance, Enter Start Wavelength, Enter End Wavelength, Enter Speed, Store Baseline, Enter Start Wavelength (2), Enter End Wavelength (2), Enter Speed (2), Enter Scale, Enter Bottom %T, Enter Top %T, Start Scan.  I need to be able to read the string only once, at the very end, after the scan completes itself and the transmission data is ready. 
 
Thanks,
0 Kudos
Message 12 of 16
(1,170 Views)
Hi Steve,
In your case, since you are not doing a continuous read/write (I am assuming), I would suggest you use a for loop, and index it with an array of the strings you want to send. Or, you can write it all as one long string. It all depends on how your instrument works. I've attached a slightly modified version of the Basic Serial Write and Read VI to use arrays.  Hope this helps.

Regards,


Ebele O.
National Instruments
0 Kudos
Message 13 of 16
(1,165 Views)

Hi Belle,

This does help and seems like it would work if only my meter would stop presenting me with a E17 Serial comms error: parity or framing.  The computer and meter are set exactly the same (9600-N-8-1), so I can't seem to find the exact problem there.

The for loop cleans up the entire process dramatically.  Before it was setting the vi attributes before each write, but now it sets the attributes, writes each command, and then reads.  I only made one change by adding a wait command inside the for loop to give the meter a chance to perform each action.  I attached the capture while running it, perhaps there is an error in there somewhere? 

0 Kudos
Message 14 of 16
(1,156 Views)

After reading the entire operators manual I discovered the source and description of my error.

E17, Transient Error Type:  Serial communication error (Baud rate, parity, or data length mismatch between instrument and connected serial device) -

1) Check application software sets correct serial parameters.

2) Check baud rate, parity etc. set correctly.

 

Does LabVIEW in some way alter baud rate, data bits, parity, stop bits, or flow control?  I am in full communication with the meter through MAX; this error only appears when I am trying to control it through LabVIEW.

0 Kudos
Message 15 of 16
(1,151 Views)
Hi Steve,

The spy capture does not show any errors; I only see a warning that says that the number of bytes transferred is equal to the inpuit count, and more data might be available. Do you get any errors from your LabVIEW program? You can create an indicator for the error output to see if there's an error. One other thing you could try is increasing the delay in your loop to see if it helps. A delay between your write VI and read VI could also be helpful, as I've seen this fix framing errors before.  Also, what version of NI-VISA do you have? Try upgrading from this link if you don't already have the latest version. Hope this helps.Thanks!

Regards,

Message Edited by _Belle on 12-05-2006 07:10 PM

Ebele O.
National Instruments
0 Kudos
Message 16 of 16
(1,128 Views)