Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

A question for enthusiast!!

Hi fellows, I am asked to log data from a device using LabVIEW. I am completely new to it. The device (a tacho meter) is supposed to send out data if we write STX n H x ETX on the rs-232 serial port. n and x are switches (numbers 1 to 5 and 1 to 2 respectively). It is not working. Can any body please guide me in this regard or send me a sample G code? I shall remain thankful.
Regards,
Faisal.
0 Kudos
Message 1 of 3
(3,259 Views)
There are several serial examples shipped with LabVIEW in the Help>>Examples>>I/O option. Make sure you have all of your port settings (baud rate, stop/data bits, parity, etc) properly designated to match your instrument.

I might also recommend checking the Instrument Driver Network (http://zone.ni.com/idnet97.nsf/browse/) to see if there is an instrument driver already developed for you instrument.
0 Kudos
Message 2 of 3
(3,259 Views)
In order to correctly build your string, you must look in the instrument documentation if n and x are expressed as characters (i.e. "1", "2" and so on) or in their equivalent numeric code (in the example above, 49, 50 and so on - decimal basis). This is important 'cause character "1" (ASCII code 49) is different from ASCII code 1, so the string you send to the instruments may be wrong due to that basic misunderstanding.

The same for start- end end-of transmission: in the ASCII character set STX stands for Start of Trasmission (ASCII code 2), while ETX is End of Transmission (ASCII code 3).
To insert non-displayable characters into a string, you must embed special escape codes in it: look in the on line help searching for 'escape codes'.

Another hint i
s to find if it is needed a termination character for the message: most instruments use return (ASCI code 13, escape code \r), but others use their own thermination character, which is usually descripted in the instrument's documentation.

And finally: how long is the instrument expected to wait before answering? Depending on the complexity of the job performed and the characteristics of the instruments, it may take some time to react to a request (I saw from milliseconds to hundreds of msecs). You must put a delay in your program to let the instrument play its job...

Hope this helps
Roberto


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 3
(3,259 Views)