01-13-2012 01:56 PM
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.
01-13-2012 02:04 PM
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
01-13-2012 02:14 PM - edited 01-13-2012 02:15 PM
Either of thes options should keep the buffer empty
01-13-2012 02:31 PM
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
01-13-2012 02:33 PM
01-13-2012 02:43 PM
think i got it, hold on
01-13-2012 02:54 PM
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.)
01-13-2012 04:46 PM
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.
01-13-2012 04:50 PM
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