LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Clear Position Task and Analog Input Task in Buffer

I want to clear the input buffer for all my tasks at the start of an acquisition. I can stop and then start the analog input voltage task to achive this.  However I don't think I can stop and then start the position task again because I will the lose the position of the encoder at that time.

 

At the end of the acquisition, I clear out the buffer because I've had problems with different acquisitions pulling different amounts of data out of the buffer for the same task, so I clear it out to make sure all data is read.  However, now the analog buffers are clear and returning zeros but the encoder is returning a value.

0 Kudos
Message 1 of 5
(3,285 Views)

Hi Linkster,

 

 I was wondering if you could clarify your question. After reading your post, I understand that you have a buffered analog input task and and buffered counter input task. You mentioned that you are clearing the analog buffer by restarting the task and that works well. However, you do not want to restart the counter task and because of this, you are still reading values from the counter. Please expand on this if you still need assistance.

 

Regards,

Kent

Applications Engineer

0 Kudos
Message 2 of 5
(3,254 Views)
The counter is reading the position of a linear actuator from an encoder.  The stage runs through a homing routine and then the stage knows it is at position 0 and then the counter takes an offset to make it's position 0 at this point too.  The stage and encoder are synchorized. If I restart the encoder at a random time, the position that it reads no longer matches the stage because the position starts at zero again.
0 Kudos
Message 3 of 5
(3,248 Views)

Hi Linkster,

 

I apologize if I am missing something that you said. I understand that your counter is currently reading the position and this is what you need it to do. If you do reset it, you will lose the current position. From what you have mentioned, it seems like everything is working well and as expected. 

 

Regards,

Kent

Applications Engineer

0 Kudos
Message 4 of 5
(3,233 Views)

Linkster,

 

Use a shift register to keep track of the encoder counts.  When the counter task restarts, add the previous value to the new value.  Some thought will need to be  put into this to make sure that the addition only occurs after the task restarts and not each time the counter is read.  Thus, the value in the shift register will be the position and the counter output will be a change in the position.

 

If the counter can be preset, preset it from the last value in the shift register rather than maintaining a separate count in software. 

 

Both of these techniques assume the program does not get stopped.  If that happens you would need to write to a file. 

 

Lynn 

Message Edited by johnsold on 09-26-2008 01:15 PM
0 Kudos
Message 5 of 5
(3,229 Views)