I agree totally, Don. VISA is the way to go. I use serial port vis to
keep the size of my .EXE smaller so I can distribute my app over
the net. It's another layer of complexity for my end user to have to
install the VISA components. (as well as a much larger download)
I can hardly wait until LV comes out with a single driver to include
with an .EXE so I can use VISA also. (like serpdrv)
Or has anyone figured out how to distribute the VISA driver
without the installation disks from NI?
Alan
Roderic Don wrote in message
news:3857A880.91863E02@ccm.udel.edu...
> Alan Brause wrote:
>
> > When I'm setting up to talk to a new instrument I use a set of sub vis I
> > have
> > created. These sub vis have in and out connectors for ComPort, Errors
and
> > messages so they utilize dataflow to determine when they operate.
> > The first vi initializes the port, the second builds the message string,
> > (including
> > CRC, if necessary) the third vi writes the message to the serial port.
> > Usually you have to wait here for some milliseconds so the reply can
come
> > back.
> > The Read vi sits in a loop and reads the bytes at the port. It has a
> > timeout
> > so if no bytes are read it can continue.
> > Once I have the reply, I check it for errors.
> >
> > Perhaps this type of data flow is what you are enforcing when you step
> > through your program now. Try breaking apart the code into sub vis and
> > let LV's dataflow handle each step.
> >
> > When you are happy with basic comms with the instrument, the sub vis
> > you have created can be used in a state machine (a case statement in
> > a while loop) to build your program.
> >
> > Regards,
> >
> > Alan Brause
> >
> > Matthias M�ller wrote in message
> > news:385534A6.2062F565@rz.uni-karlsruhe.de...
> > > Hello,
> > > I'm new to LabView and try to write a library, that lets me control a
> > > spectrometer using the serial port.
> > > I've done this already and anything works fine as long as I am in the
> > > dubigging step by step mode. When I want to run my program in the
normal
> > > execution mose all the serial data get mixed up and are not
synchronized
> > > anymore (that's what I guess it is).
> > > The communication is following:
> > > 5-byte data-word written on the serial port --> the word is reflected
> > > immediately.
> > > then it depends,.. maybe a handshake byte and the aquired data can be
> > > read from the port.
> > > So I do following:
> > >
> > > I write the word on the port, put the error-output of the serial write
> > > on a while loop without condition and put a serial read vi in there,
> > > with the bytes to read=5. then i compare the sent string and the
> > > received and if true go to send to handshaking byte.
> > >
> > > i think it should work,... but i tried it with the
> > > GetNumberOfBytesAtSerialPort.vi too, but in execution mode it says ,
> > > that there are no bytes at the port....
> > > So i wondered if there could be a timing problem and tried out some
> > > delay-timers, without access,...
> > >
> > > I would be very glad, if you could give me some advices...
> > > Thanks in advance...
> > > Matthias
> > >
>
> Alan's advice is excellent, the only thing I would add is to use VISA. It
> allows setting and enabling a termination character on reads, which for
> situations where there are a variable number of bytes returned is a real
> convenience - no need to build in a pause and to read the bytes available
in
> the serial buffer. You can also change the termination character on the
fly
> if needed (I do).
> VISA also allows locking of its "sessions", which has worked out well for
me
> with a setup where I have a variable number of devices attached to each
> serial port in daisy chain fashion (both RS-232 and -485). So I have
parallel
> loops to handle communication with each device, and lock and unlock the
> shared port/session as needed to prevent communication mix-ups.
>
> Rod
> --
> Roderic Don
> Research Associate II
> University of Delaware
> Center for Composite Materials
> 302-831-8352
> 302-831-8525 (FAX)
> ---------------------------------------------
> "Stressed would mean that the pandemonium can be measured!"
> - Scott "Scooter" Holmes
>
>