Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Running two identical serial devices with one device driver

Hi,
 
I am trying to use 1 device driver to run 2 of power meters that acquire date in parallel using LabView 7.1. Please look at the JPEG file. When I run my program, "Watts Up Pro Read", the READ.VI of my device driver, toggles between COM1 and COM2, as if there was a naming issue. I have instantiated two separate "Watts UP Pro Read" VI's, so I expected that each will work with the tasks wired to it, but it doesn't. Why isn't this permissible? What can I do to run two devices with a single device driver in this same program? Any help will be appreciated.
 
Thank You,
Molana

Message Edited by Molana on 11-29-2005 01:42 PM

Message Edited by Molana on 11-29-2005 01:43 PM

Download All
0 Kudos
Message 1 of 5
(3,937 Views)

you have to look into your driver read vi. Try to make it reentrant.  Does it use not initialized shift register(s) ?

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 2 of 5
(3,903 Views)
Molana,

you have both reads in one single while loop. This means both reads are executed once in each iteration., independently if there are any data availabel for them or not.
As the devices are running independently, I'd suggest to use two independently running whiles, one for each device.
If there are any data to share between both devices or with a third process (in a 3rd independent while loop),  use a named queue or similar means to share data. Stop the loops with one single boolean control or indicator that connects to the termination terminal of one of those loops. Use locals of this control to stop the other while loops.
Do not forget to discard /release the named queue after leaving the while(s).

HTH   and     Greetings from Germany!<br>-- <br>Uwe
0 Kudos
Message 3 of 5
(3,900 Views)
Thank you for your message. I will try to put them into two seperate while loops and see how it works from there. By the way, what is a named queue in LabView?

Molana
0 Kudos
Message 4 of 5
(3,889 Views)
Queues are a means to synchronise independent processes and to pass data between those. There are others, amoung are notifiers,  semaphores, occurences and rendezvous. Queues use system ressources to pass data asyncrounously from one process to the other. They can have names as 'Commands' or 'Result_Device1', which makes it much easier to read your code later and to communicate over programs borders. Queues 'buffer' data, which means you can for example quickly put several commands into a command queue and execute them one-after-the-other and much slower. There is just one dependency between the sender and the receiver of such a que, which is that the receiver just gets data after the sender has sent some.  But one can have several senders and maybe even several receivers and none has to wait for each of the others.

You find 'em in Functions/Advanced/Synchronisation/QueueOperations.

From the help of obtain_queue:
Use named queues to pass data between two sections of a block diagram or between two VIs. If you do not wire name, the function creates a new, unnamed queue reference. If you wire name, the function first searches for an existing queue with the same name and returns a new reference to the existing queue. If a queue with the same name does not already exist and create if not found? is TRUE, the function creates a new, named queue reference.
...
Example: Refer to the Queue Basics VI in the labview\examples\general\queue.llb directory for an example of using the Obtain Queue function.

HTH   and Greetings from Germany!<br>-- <br>Uwe
0 Kudos
Message 5 of 5
(3,878 Views)