Hi Dan, we ended up implementing your option 2, but it took a many
wasted hours to figure out asynchronous VISA wasn't all it was cracked
up to be.  The application was a lot simpler to write asynchronously,
but we had to junk it and start over.  My coding partner was pretty
annoyed that I pushed him to get rid of the legacy serial and finally
upgrade to LV7.

We also tried two different Serial Configure statements, but I didn't
realize that an explicit VISA Open would have helped.  It would be great
if some of this information was available on the Developer Zone

Thanks for your explanation; at least we're somewhat less confused.

Jason Dunham
SF Industrial Software, Inc.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 04, 2004 2:13 PM
To: Jason Dunham
Cc: Info LabVIEW Mailing List
Subject: Re: Asyncrhonous Serial VISA





Jason:

The part that's causing problems for you is that you can't have 2
simultaneous asynchronous write/read calls in progress on the same VISA
session.  So there are 3 solutions I can come up with that might help:
1) Use 2 different VISA sessions.  Make sure to explicitly call VISA
Open
before calling Configure Serial Port, and make sure that 'open duplicate
session' is set to True.  In this case, make sure you close both session
refnums when you are done, with VISA Close.  (The default to 'open
duplicate session' is False, which lets LabVIEW recycle sessions.  But
when
you explicitly open duplicate sessions, you're in charge of releasing
them.)
2) Use the 'VISA Bytes at Serial Port' property node to check for data
having arrived, in a loop, before you call VISA Read.  That way it won't
block in the asynchronous node.
3) Use the 'VISA Wait on Event' function to wait for the
'Serial-Character'
or 'Serial-TermChar' event (make sure you enable it first.) before you
call
VISA Read.

Suggestions 2 and 3 are pretty much the same, except the fact that in
case
#2, you'll need to create a while loop with a sleep, whereas in case #3,
VISA basically does exactly that for you.

To be honest, the choice of synchronous versus asynchronous I/O is
pretty
much irrelevant since LabVIEW 7.0 came out.  Because each execution
system
contains multiple threads, synchronous I/O on one thread doesn't prevent
other LabVIEW execution paths within the same execution system.  It's
still
useful if, for example, you wanted to read from 16 different serial
ports,
all in parallel (no pun intended).  With synchronous I/O, there wouldn't
be
enough LabVIEW threads to handle them all simultaneously.  But with
asynchronous I/O, it works reasonably well.  (Yes, this case has come
up.)

I hope this explanation helps.

Dan Mondrik
National Instruments



|---------+-------------------------------->
|         |           "Jason Dunham"       |
|         |           <[EMAIL PROTECTED]>   |
|         |           Sent by:             |
|         |           <[EMAIL PROTECTED]|
|         |           .nhmfl.gov>          |
|         |                                |
|         |                                |
|         |           06-04-2004 01:44 PM  |
|---------+-------------------------------->
 
>-----------------------------------------------------------------------
---------------------------------------|
  |
|
  |       To:       "Info LabVIEW Mailing List"
<[EMAIL PROTECTED]>                                 |
  |       cc:
|
  |       Subject:  Asyncrhonous Serial VISA
|
 
>-----------------------------------------------------------------------
---------------------------------------|




Is anyone having success at running asynchronous VISA calls for serial
port
reads and writes?


I made a simple test VI to read one byte from COM1, and write a
continuous
stream of bytes out of the same port in a parallel while loop.


The write loop stalls until the read command times out.  I even tried
moving the read to a subvi and changing it's execution system, but to no
avail.


If I read and write from different ports it the read and write are
independent, even if the VISA nodes are set to run synchronously.


I'm just not getting the whole asynchronous concept, I guess.  I have
yet
to create a VI which behaves different with sync or async VISA calls.


I'm using LV 7.1, VISA 3.1 and Windows XP.





Jason Dunham


SF Industrial Software, Inc.






Reply via email to