Problem setting motor encoder
I am unable to set the motor encoder to the value I desire. I want to set it in the middle of its range of possible values (<= 0 <= 32768) so that I won't have to contend with negative encoder values, which release the brakes. Here is some simple code to see the problem:
#pragma config(Motor, motorA, motor_A, tmotorNormal, PIDControl)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
nMotorPIDSpeedCtrl[motorA] = mtrSpeedReg; // Enable motor-speed regulation
bFloatDuringInactiveMotorPWM = false; // Brakes on
nMotorEncoder[motorA] = 16384; // Initial encoder value
motorEncoderValue = nMotorEncoder[motorA]; // Current value of motor encoder
When I use the debugger to single step through this with the Global Variables window open, I get motorEncoderValue = 0 even though I have set the motor encoder value to 16384, in the middle of the range of possible values.
I am using Robot C Ver. 1.45.
Has anyone any ideas about what is wrong?