03-10-2010 04:21 AM
Visual Studio C#, PCI-6220
I'm using encoder to chceck motor position- using counter input A,B,Z (encoder inputs).
Ussualy I need check position form time to time (for example 5 sec period) so I:
1) Create a task
2) Run a task
3) From time to time I call "Read Int32"
It works fine I've got acctual position in pulses, but...
Once time I need take N samples using external source, and after that return to state before.
So If I will crate new task to buffered reading I will lost acctual position (Creating task make counter to 0) - but acctual position is very important for me.
Is any chance to not lost position changing task form simple reading to buffered reading?
03-10-2010 09:37 AM
When creating the task, you can pass the initial position as parameter for positioning tasks. Refer to the help of the CreateLinearEncoderChannel Method or CreateAngularEncoderChannel Method for further info.
hope this helps,
Norbert
03-11-2010 01:17 AM
When I set initial value to encoder with Z-channel, Z-signal comes sets initial value to the counter not zero.
For Example: If I set initial value to 5, after Z-signal it will be 5 in counter not 0.
Other problem is channging tasks time - when I stop one task and start another it takes some time - so it is possible to lost some encoder pulses then. Am I right?
So problem is not solved.
03-11-2010 03:38 AM
Hey Jakub,
You could also use the second counter for the Finite Aquisition, and run two tasks parallel. Or do You need the second counter for something else?
Regards,
David Varga
Applicatins Engineer
NIH
03-11-2010 03:46 AM
Of course I could but...
I've got 4 counters on card and 4 encoder to use, so its problem...
03-16-2010 05:42 AM
Hey Jakub,
Sorry for the late response! First of all, the PCI-6220 has only 2 counters, I guess You are using two boards then. Setting the initial value only sets the value that will appear when You start the VI or Your Task, the value that will come after a Z pulse can be set with Z Index Value property. So actually it is good for You if there is no movement during the changing of the tasks. Unfortunatelly this change takes some time, so if there is a movement, You will miss it. Is that external clock always available for You? You might use only the finit aquisition and when it's not needed just trash the data acquired.
Best regards,
David Varga
Applications Engineer
NIH