LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Priority of output

Hello,

I am making a simple VI using DAQ AI,AO and VISA read and write with RS232.

The aim of the VI is to use two computer/PXI and receive the giving data in one computer and receiving the same data with a time delay of 5sec(for e.g) or 1min.

also later an array of data to be transferred from one computer to another after a delay of 10sec.

1.I have developed the VI for single data but it receives only once and then if I change the data the data is not received.(see attached file 1) for single data

2. I have developed the VI for array of data but I am confused how can I use the array with VISA.(see attached data file 2) for multiple data

3. Also Stop is not working

4. I want to know how can I set the priority or sequence in the VI with time

I am not sure if my coding is correct, can someone suggest or advice for the same.

 

Download All
0 Kudos
Message 1 of 7
(2,490 Views)

Hi KRAZE4LV,

 

I took a look at your vi's and I've got some questions about what you are trying to accomplish. 

 

Are you sending data from one computer to another computer with a 5 second or 1 min delay? Or are you acquiring data with computer 1 using daqmx drivers and then sending that data to computer 2 via computer 1 with visa drivers? Are you trying to send only one piece of data at a time and build an array on computer 2? Please clarify this. 

 

As for the stop, if the stop button is pressed while the code is executing inside the inner while loop, it will not stop until that loop is finished executing. That is why it may seem to be not working. 

 

You can use a sequence structure with waits in them to prioritize with time. 

 

Regards,

Travis Ann Nylin

 

 

 

 

Customer Education Product Marketing Manager
National Instruments
0 Kudos
Message 2 of 7
(2,459 Views)

Your inner while loop in the first VI will either run exactly once, or it will run forever.  Your stop button is in the outer while loop, it gets read and passed to the inner while loop.  If the stop button is pressed before the program runs, the value will be true, the inner while loop will run once and stop, then the outer while loop will finish and stop.

 

If the button is not pressed, then the value is false, the inner while loop starts running and can never be stopped because the value on that wire will always be false.

 

This is basic knowledge of dataflow in LabVIEW.

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 3 of 7
(2,449 Views)

Hello Travis,

Thank you for the reply!

I am using the PXI DAQ 6251 and general desktop computer with RS232

The purpose of the VI:

1. Write data in AO multiple channel  using a random generator

2. Read the data on AI channel multiple channel

3. Change the data to engineering value

4. Give time delay of 100ms.

5. Receive data on VISA write and use VISA read to read the data on the Desktop using COM.

Please see my attached Program. I use the same Vi on PXI and desktop.

When I run the VI, I get errors:

1. Error -1073807339 for VISA close session, I deleted the Close session in one of the VI  But the problem persisted. The error appeared in both sides.

2. Error-200099 for Analog channels, because I am using the desktop which does not have NI DAQ channels. so I just continued.

Please give your suggestion about the VI attached and how to get rid of errors.

 

 

 

0 Kudos
Message 4 of 7
(2,428 Views)

The use of sequence structures is actively discouraged by the community, espescially when starting out with LabVIEW.

If you have not yet done so, I reccommend folowing one or both of the tutorials that Ravens Fan posted and then looking at the VI templates and design patterns in File->New... From your description, a form of state machine should be suitable

 

Your error -1073807339, is a timeout error. It is probably because you have set the timeout to 100ms and are instructing the VISA read VI to read 100 bytes. Either there are not 100 bytes in the buffer, or 100ms is not long enough to empty the buffer. You can wire the byes returned into the read bytes to empty the buffer in a controlled manner.

 

Furthermore, you are creating and destroying references each time you come around to read/write to hardware; it is better to create and destroy references outside fo a loop, and use accessing VIs within a loop.

_____________________________
- Cheers, Ed
0 Kudos
Message 5 of 7
(2,416 Views)

Thanks I have modified my VI based on the comments above. Please see the attached.

But I wish to understand more detail about the time duration control. Now I am using the state machine.

The aim of VI:

1. Create AO channel with a random function.

2. Change to engineering value. dispalyed every 100msec

3. Write on VISA and then give delay of 2 sec

4. Display this data as an indicator and transfer this data through VISA read with time duration of 2sec.

5. This will be displayed on the other computer through RS232.

Quetsions:

1. IF PXI data for 1s is A, 2s is B, 3s is C, 4s is D, 5s is E, 6s is F

but if we switch on the other computer  through RS232 or start running the other side at 0.5sec then the data recorded will be *A, at 2.5s is *B, 3.5sec is *C how can i extract every 2sec i.e A, 4sec i.e C etc.

2. Time for overall VI is 2sec but I want the overall loop time for the VI to run be 100ms but VISA read should be 2sec

3. How can do the loop control using the remainder/quotient function, on the basis of the time?

 

0 Kudos
Message 6 of 7
(2,386 Views)

Hi KRAZE4LV,

 

I don’t understand completely your application, are you acquiring data in one computer and sending it to another computer with a serial communication? If so, you will be having timing issues because it will be difficult to sync both computers, with this protocol. Besides, RS-232 protocol not always has the available bandwidth to send all the information.

 

The best way to share information between two computers will be with network shared variables, you can find more information about this in this link.

 

 

Regards,

steve.bm
AE | NI
0 Kudos
Message 7 of 7
(2,350 Views)