LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

plot and program have lag

well- then it's pretty sure that you are not reading out of the buffer as fast as measurments are going into it. two ways to skin that cat:

 

1 change the task to 1 sample on demand.  Each loop iteration will start the acquisition and return that value.

 

2 Change the read to single channel n samples and wire -1 to samples to read .  Each loop iteration will return everything in the buffer.


"Should be" isn't "Is" -Jay
0 Kudos
Message 11 of 19
(590 Views)

jeff,

i honestly dont understand the two options.

      i dont see the "sample on demand" option with daqmx.  I think that is an express vi thing frin a google search?

     how do i configure it and is task two dependent on the first?

 

modifying the file might work out better, i can then copy it in

 

 

0 Kudos
Message 12 of 19
(587 Views)

 

 

Either of thes options should keep the buffer empty

 

daqmx.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 13 of 19
(582 Views)

 

jeff,

i appreciate all the help your providing

im still not there

 

if i do that, the plot window just locks up

that is with the continous or finite samples option

 

ill just attach the full blow code.

the channel with the lag is quesiton is dev4/AI 12

the serial port is now working the way it should be although there is a big delay which is probbably cuasing the bottleneck that i didnt see with the other servodrive

 

 

 

0 Kudos
Message 14 of 19
(579 Views)
0 Kudos
Message 15 of 19
(575 Views)

think i got it, hold on

 

0 Kudos
Message 16 of 19
(572 Views)

Jim,

Your code still has nothing to enforce that the last vi called before entering the loop is AI Start task. when you get that fixed the lag will be gone as loong as the loop can cycle fast enough.

 

You are doing a lot in that loop and we may need to go to a producer consumer data design pattern to do the data analisys and file IO.  there is an example of this pattern that ships with labview. You'll want to look at it.

 

Another thing that will reduce the bloat is getting rid of all those express vi's (well elapsed time isn't too bloated but there has got to be a faster way to generate the single data point you write to the AO.)


"Should be" isn't "Is" -Jay
0 Kudos
Message 17 of 19
(571 Views)

 

hi jeff

reading hte 10 (or 1000)  sample points rather than the individual point works in some regards.

 but the timing is very off.

if i want to create a sinusodial waveform at 3Hz,  governed by the simulate signal express vi, I have to change the frequency parameters to it to run at 30Hz

im sure this is somewhat related to the same clock

then i have to adjust the other channels too so each data point is sychronized in the collected data.

 

if i could just get rid of the periodic serial port errors, i could run the program the way the other one runs

even this  one runs right some of hte time, but it hangs up  alot due to serial errors.

I havent been able to put my figure on it yet.

 

0 Kudos
Message 18 of 19
(562 Views)

 

 

the program really does work flawlessly if i get rid of the serial errors

i think i found out what is causing it

if i have the power shut off on the servo drive, and then try to send a serial command, nothing will happen.

but you would think it is fixed when the power is put back on but its not.

for some reason, i have to go into the vendors software and initiate serial communicaiton with the servo drive

then i can go back into labview and operate it without any delays again

 

ahhh, one week to get to this point.

so i bet i can use a serial break or something to flush out the serial port, im going to have to try to just fix the serial port

 

0 Kudos
Message 19 of 19
(560 Views)