Hi,
I was trying the nmotorencodertarget function to instruct the motors to turn to an accurate position. however, I have failed, for the same reason you've told.
Since I was working on a plotter that requires quite accurate positioning I have created my own task to control the motors to reach a specific encoder value.
This task is executed a few hundred times a second (execution may take 1 msec or so and then it waits one more msec). The main task simply sets the target[i] variable like the pen up function here:
It is of course possible to set targets for two motors at the same time. Since in my case speed was not an important factor the constants MFAST was set to 20 and MSLOW was set to 10. In such slow speed the motors were capable to reach their target quite well therefore the constant CLOSE (which is actually the tolerance) is zero.
Realize that this task is more autonomous than RobotC's built in nmotorencodertarget. Using the built in function you first set the target then start the motors. My implementation strarts the motor every time the position does not match the target -- even if an external torque turns the motor axle. Applying a constant torque on the motor axle (e.g. in a poorly designed crane) my solution might start to "oscillate".