Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Possible to not clear encoder value when changing task? (C#)

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?

 

 

 

 

0 Kudos
Message 1 of 6
(4,316 Views)

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

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 6
(4,302 Views)

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.

0 Kudos
Message 3 of 6
(4,290 Views)

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

0 Kudos
Message 4 of 6
(4,283 Views)

Of course I could but...

 

I've got 4 counters on card and 4 encoder to use, so its problem...

0 Kudos
Message 5 of 6
(4,280 Views)

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

0 Kudos
Message 6 of 6
(4,236 Views)