From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I wrote a VI using GPIB port for TDS420A, now i wan to use RS232 also, but it don't work

Hello,

I connected the TDS420A scope with the host computer, and i used GPIB to configure the baud rate, stop bits... ...
and i also used VISA VI to configure the COM1 port

and when i change the VISA resource to COM1, it just read nothing in the buffer....
0 Kudos
Message 1 of 17
(4,362 Views)
I'll assume that you've also set the pc's serial port to the same settings but did you set the termination character for serial writes. I'm almost certain that in serial mode the scope needs a termination character to process the command string. This would be something like a line feed or carriage return character at the end of the command (check your manual for the character required). When you use the VISA Property Node for setting the pc's com port, use the property ASRL End Out and set it to TermChar. Then set the TermChar property to the correct character. If you want an example of how this is done, download the HP34970A driver from NI. If you want, you can probably also add the term character to every VISA Write that you do. When you use it for GPIB,
the extra character should be ignored.
0 Kudos
Message 2 of 17
(4,362 Views)
Hmm. Parts of your question don't make sense, but I think I can help you.

LabVIEW has a couple of different ways of talking to GPIB devices, but only one of those ways also works with serial. You can either use the "Traditional GPIB" functions, which _only_ work with GPIB, or you can use the VISA functions, which can work with GPIB, Serial, USB, Ethernet, etc.

So, you should only be using VISA functions. Fortunately, you probably just need to add a few things to get it to work with serial.

Are you starting with the TDS 420 instrument driver from http://ni.com/idnet ? If not, that might make things easier. It doesn't appear to already have serial support, so you'll need to modify it.

My first guess at the problems you are having is that most serial instruments have to have some sort of termination character added to commands when they are sent. So instead of just sending "CURV?", you may have to send "CURV?\n" (where \n is a newline character).

You should read the manual or test your instrument to see what kind of termination character it wants. It's probably either \n or \r (carriage return).

Once you know that, there are a couple of approaches to take. (1) You can edit all of your commands in all of your VIs to add the termination characters. If you only have a few VIs, this isn't too hard. Or, (2) you can tell VISA to automatically add the termination character for you. This is easier.

To do the second option, you can use the VISA Configure Serial Port VI to configure the termination characters.

If you are modifying the instrument driver and want it to continue to work with GPIB, you can put the call to "VISA Configure Serial Port" into a case structure frame that's only called when the interface type is "Serial". You can check this with the VISA property called "Interface Information:Interface Type". Several of our existing instrument drivers do this trick. You could probably search the http://ni.com/idnet for drivers that support GPIB and Serial to see how it's done.

I hope this helps.

Brian
0 Kudos
Message 3 of 17
(4,362 Views)
Hello Brian,
how do i know that TDS 420A support serial too, if the user manual stated
Qoute from TDS 420A ... ... User manual
"Full GPIB software programmability. GPIB hardcopy output. On instruments equipped with option 13, hardcopy output using the RS-232 or Centronics ports"

I afraid that the RS232 port is only use for hardcopy output, and only GPIB port can be use to program
0 Kudos
Message 4 of 17
(4,360 Views)
I'd be surprised if you couldn't use the RS-232 port for communications. I have a Tek TDS 310 that can use either GPIB or serial.

On my 310, I have to go to the Utility->I/O menu to tell it to use RS-232 instead of GPIB. From here, I can also set baud rate, hardware flagging (a.k.a., flow control), etc.

Brian
0 Kudos
Message 5 of 17
(4,360 Views)
hmm i will try to use RS-232 on the TDS 420A
so i only need to try adding EOF, either /n , /r or 04
+ config serial using VISA serial configure vi, host computer and TDS 420A setting same

by doing all above, i will be able to communication without changing the program using GPIB? (so the program work for GPIB and Serial RS232)
wonder how i going to let user choose which port to use
0 Kudos
Message 6 of 17
(4,360 Views)
The TDS 310 had an option for setting the serial termination character. Mine was set for linefeed.

So, I think you just need to add "VISA Configure Serial Port" to set up your VISA connection correctly.

The end user can select between GPIB and Serial by selecting the appropriate device from the VISA Name Control (in LV 6 or later). They either select "COM1" or something like "GPIB::22::INSTR".

Brian
Message 7 of 17
(4,358 Views)
I can't choose serial termination charactor for the TDS 420A, in system < I/O>, i can select Port but under it only have
Configure HardCopy -> Hardcopy
HardWare Setup -> Baud Rate, Stop Bits, Parity and Hard Flagging
Software Setup -> Soft Flagging
0 Kudos
Message 8 of 17
(4,358 Views)
In one of your earlier posts, you mentioned that the manual said that the RS232 was only for hardcopy output. I looked at the manual also and that's the impression I get as well. You might want to contact Tek directly to confirm that but it looks like you might be spending a lot of time on something that's not supported by your instrument.
0 Kudos
Message 9 of 17
(4,358 Views)
Thanks,

Thanks you guys for helping me, although it not solved, but it actually considered as solved, cause aleast we know that this instrument cannot be RS232 programmed
0 Kudos
Message 10 of 17
(4,358 Views)