LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 comms using multiple ports

Hello, I'm a beginner with LabView and have been given the task of
programming LabView to work with National Instrument's PCI-232/16 Serial
Interface Card and breakout box. It looks like that my LabView program
will grow out of control in order to control all 16 ports. I was
wondering if anyone has had some experience with multiple ports. My task
is fairly simple, open some or all of the 16 ports, send a request for
information message, listen for response from other end, and print
status to the screen. Occasionally, I might have to send a RESET message
to the other end of my link. Also, the program will run in an infinite
loop, constantly requesting the status of my equipment at the end of the
link.

If anyone can hel
p, or could recommend a good book, just shoot me an
email.

Thanks,
Joe
0 Kudos
Message 1 of 4
(3,510 Views)
Do simultaneous connections need to be open? If not it's fairly trivial-
make your code that opens a port, sends the request for status, reads it
back and checks to see if you pressed reset before closing the port, and
then once that works put it all inside a for loop fed by an array of 16
serial port numbers and 16 reset Booleans. Put the whole thing- including
the terminal for the reset buttons- inside an infinite while loop with a
time delay and that's it. If you don't want to use all the ports, have
another array of 16 "enable" Boolean controls that controls a case structure
inside the for loop and around everything in the for loop, so a serial port
is only accessed if the corresponding Boolean is set. Make sure all your
arrays are set to autoindex as they go int
o the loop, and you don't need to
bother wiring a number to the "N" terminal of the loop- it simply executes
as many times as there are elements in the arrays.

Joe Lindula wrote in message
news:39FF30CC.989FC3EA@hotmail.com...
> Hello, I'm a beginner with LabView and have been given the task of
> programming LabView to work with National Instrument's PCI-232/16 Serial
> Interface Card and breakout box. It looks like that my LabView program
> will grow out of control in order to control all 16 ports. I was
> wondering if anyone has had some experience with multiple ports. My task
0 Kudos
Message 2 of 4
(3,510 Views)
[posted and mailed]

jjlindula@hotmail.com (Joe Lindula) wrote in
<39FF30CC.989FC3EA@hotmail.com>:

>Hello, I'm a beginner with LabView and have been given the task of
>programming LabView to work with National Instrument's PCI-232/16 Serial
>Interface Card and breakout box. It looks like that my LabView program
>will grow out of control in order to control all 16 ports. I was
>wondering if anyone has had some experience with multiple ports. My task
>is fairly simple, open some or all of the 16 ports, send a request for
>information message, listen for response from other end, and print
>status to the screen. Occasionally, I might have to send a RESET message
>to the other end of my link. Also, the program will run in an infinite
>loop, constantly requesting the status of m
y equipment at the end of the
>link.
>
>If anyone can help, or could recommend a good book, just shoot me an
>email.
>

There are no real considerations here other than those that go with all
difficult programming tasks. Perhaps you want to consider designing your
application before coding it to begin to see where problems might lie.

Another alternative is to look at GOOP (G oop programming) and devise
objects to attach to. However from your "beginner" status the higher level
considerations such as GOOP are a probably a while off.

Essentially labview is a "parallel" language, and so a simple solution to
your problem is 16 parallel while loops waiting for a stop button to be
pressed. I would check out the range of books on programming in LabVIEW.
These can be found on the NI website - the best of for beginners is
"Graphical Programming in LabVIEW". IIRC there is a section on serial
instruments in this book.

Alex.
0 Kudos
Message 3 of 4
(3,510 Views)
I set up a control that used 8 serial ports together and did so by setting
each port up in a loop that passes the reference into an array. then when
you want to access any port you just index the array to the port you require
and you have the reference.

if you want to see the code then email me and I can mail it to you.

Cheers
Rob Kennedy
CPE Systems Pty/Ltd
Victoria Australia

rkennedy@cpesys.com.au
0 Kudos
Message 4 of 4
(3,510 Views)