LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When i run position measurement vi using 6602 & continuous handshake input vi using 6534, counter vi updates the counter value slowly

Hello,
I am using buffered continuous handshake input vi to acquire the digital data using PXI-6534. I am also running the position measurement vi to acquire the rotary encoder motion. When i run both above vi one after one they work fine. But when i run both the vi together (i m opening both the vi in separate windows, then i run individually at same time), position measurement vi updates counter value slowly (though the pulses coming to 6602 counter are at same rate of 3.6 KHz). I m mentioning the system resources spec:
PXI-1002 using MXI-3 link(5 m copper wire)
Host PC: Intel Pentium 4 (2.6 GHz) with 256 MB RAM.

I am at
taching both the vi. Position measurement vi is same but cont handshake input vi is taken from example programms).

Pl. help urgently with some solution.

Thanx in advance,

Best Regards,
Nirmal Sharma
0 Kudos
Message 1 of 4
(2,758 Views)
Hello Nimal,
Thank you for contacting National Instruments!
The reason that you are experiencing this problem is because the Traditional NI-DAQ driver is single-threaded. Your Cont handshake input VI has a DIO Read VI inside a while loop with no wait. When this VI runs, the DIO Read VI will wait until it has acquired all of the Scans to Read and then will release the driver to be used by your position measurement. The VI will either read the number scans in the backlog or the number of scans to read. Since you do not have a wait, it is likely that the scan backlog is alway nearly zero. This means that the DIO Read VI will almost always be waiting for the total number scans to read before it releases the driver.

You can do a couple things to alleviate this pr
oblem.

1. Place a delay inside your Cont. Handshake input VI's while loop. This will cause your backlog to grow. Do not use too large of delay for your scan backlog will grow out of control and overflow the buffer. 1 - 10ms should work fine.
2. The best way to solve this problem is to combine the two VIs into a single VI. This way, you can use the error cluster to control when things execute. You can have both sets of code in parallel and then snake the error cluster from the first set of code to the next. This will cause the DIO code to get configured first then the counter code and then in the loop, you would run the error cluster to the DIO Read and then to the counter get attribute to read the position. This would ensure that both measurements had equal time.

The easiest thing to try is to decrease the scans to read in the Cont Handshake input and insert a delay in
the while loop.

Let me know if you are successful.

Regards,
Bill B.
Applications Engineer

National Instruments"
0 Kudos
Message 2 of 4
(2,758 Views)
Thanx Bill for your kind response.

I will try above methods & let me check the results.

Mean time i have tried buffer position measurement instead of position mesurement method for encoder position through PXI-6602. Here i am getting all the counts. I am running both the vi (Buffered position & DIO handshake input), after 2-4 times running, i get error such as 10401/10409/10408. In DIO handshake vi, i m configuring 2 buffers, one for input & other for output. I have given group 0 to input buffer & group 1 to output buffer. For counter i have given buffer group as 6. Still i m facing the bufffer group problem. Sometimes i get error 10401 which says that the device is not from NI..or 10409 that is buffer is in use....

As i have switch
ed to this method, let me get idea why these problems are occuring.

Secondly if my first method (position measurement) works fine, i will be happy.

I am attaching cont handshake input vi(modified). Pl. ignore sub vi incase it prompts. Pl. let me know any suggestions/modifications required other than delay.

Thanx again for your response,

Best Regards,
Nirmal
0 Kudos
Message 3 of 4
(2,758 Views)
Nimal,

I noticed that in your code, you have two while loops that are running in parallel. This is going to cause synchronization problems for one loop is going to dominate the other. Specifically, the loop with DIO Read will not allow the loop with DIO Write to execute until it has acquired all of the samples that it has set to read per loop iteration. A better practice would be to only have a single while loop and then cause data to be written by DIO Write and then have data read by DIO Read. You can connect the error cluster from DIO Write to DIO Read which will cause DIO Read to execute immediately after DIO Write. In your current application it is possible for execution to be stuck in one loop and rarely execute the code in the other. Yo
u may also be able to place delays in both loops, but combining them both into single loop would be the best.

Regards,
Bill B.
0 Kudos
Message 4 of 4
(2,758 Views)