LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

troubleshooting VISA write

I'm transitioning from the serial read and write primitives that have worked well for years, into Labview 7.1 and the VISA write and VISA read VIs. Having major problems.
I've attached a simple VISA write program that just outputs a selected command - like "2CPA10101010" to COM1 serial port. It appears to run, but the machine on the other end isn't receiving anything.
When I switch back to the older serial primitives, the machine on the end of the serial port works fine. Using this very simple VISA write vi, nada.

Perhaps someone would give a clue what I'm doing wrong.
Thx!
0 Kudos
Message 1 of 9
(3,465 Views)
I am not sure if this will solve your problem but it's worth a try. You are not closing your Visa session in your vi. Maybe the port is getting hung up. Try putting in a Close Visa and then reboot your machine. Also, your problem explanation mentions COM1, yet your Visa Resource name in your vi is ASRL2::INSTR, which is COM2. Maybe this is why your other machine isn't getting anything.
- tbob

Inventor of the WORM Global
Message 2 of 9
(3,465 Views)
Thanks, Tbob..
I've tried both com1, ASRL1::INSTR and com2 as you noted, none of those help, including with reboots. Meanwhile, not even needing reboots, the older serial routines still work (not at the same time of course..) to com1 or com2.

I also tried the VISA Close, then a 50ms timer, then a VISA Open, another 50ms timer, then the VISA Write, then a timer, and loop back to the start. Nada.

I am wondering now if NI VISA is requiring hardware handshaking of some kind - that's what it's looking like, and the serial port has only three wires on it, so there's no handshaking available. When I try to click on VISA Write, nothing opens up to show me the internal guts of the VI - is this a setting of some kind, or isn't NI allowing examination of their i
nternals anymore?

Thank you!
0 Kudos
Message 3 of 9
(3,465 Views)
Also, you can try using the "Basic Serial Write and Read.vi" example program that comes with LabVIEW (Found under Help>>Find Examples, search for 'Serial'). This vi uses VISA write and VISA read.
Good luck!

Swapnil P.
National Instruments Engineer
0 Kudos
Message 4 of 9
(3,465 Views)
VISA does not require any hardware handshaking. I don't have 7.1 so I can't open up your example. When you send the command string, are you also sending a termination character? Most serial instruments required this. It's usually a carriage return or line feed and you either have to append this to the string you're sending or configure it with a VISA Property Node.
0 Kudos
Message 5 of 9
(3,465 Views)
Thank you! This vi is working, so it is not a hardware problem. Seems like a lot of stuff needed to make the VISA work, and I'd hoped that it would be simpler. (That's probably why I used the older serial r/w vi's instead of the VISA's back when - lots simpler to use.)

Anyway, this vi does talk bidirectionally to the instrument. I'll use that as a model in the application.

Thanks! Dave
0 Kudos
Message 6 of 9
(3,465 Views)
Thanks, Dennis.. yes, I was sending a \r command at the end of the lines, which is what the instrument needs. Missing was the other associated "stuff" that the VISA needs - I'd hoped it would be simpler, like the older serial r/w vi's used to be. Thx!
0 Kudos
Message 7 of 9
(3,465 Views)
I looked at your vi again and noticed two things:
1. Inside your loop, you are opening a Visa session and Writing to Visa, no close. On your second loop iteration, you will open again without it being closed beforehand. Move your open to outside the loop.
2. This is pertaining to receiving instead of transmitting. Your termination character is set to 0xA which is the same as \n. If you are using \r, set the termination character to 0xD.
None of these may solve your transmission problem, but they are problems anyway.
- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 9
(3,465 Views)
To All:
Using the examples code, I found that my vi worked fine when I modified it some and changed it to synchronous instead of asynch. Would have thought it'd work asynch, but nope. I suppose that makes some sense. Will continue from there, and it did indeed turn out to be simple stuff (technical term..).
Thanks, all!! Dave
0 Kudos
Message 9 of 9
(3,465 Views)