Discussion:
troubleshooting VISA write
(too old to reply)
tbob
2004-09-16 19:24:38 UTC
Permalink
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.
felt
2004-09-17 15:55:12 UTC
Permalink
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 internals anymore?

Thank you!
Dennis Knutson
2004-09-17 16:29:42 UTC
Permalink
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.
felt
2004-09-17 16:45:11 UTC
Permalink
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!
Swapnil
2004-09-17 15:56:51 UTC
Permalink
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
felt
2004-09-17 16:42:02 UTC
Permalink
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
tbob
2004-09-17 17:15:45 UTC
Permalink
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.
felt
2004-09-20 17:53:22 UTC
Permalink
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

Continue reading on narkive:
Loading...