Quadrature Encoders

I am trying to use two quadrature encoders with robotc v2.31. Here is my code:

#pragma config(Sensor, dgtl1,  right,               sensorQuadEncoder)
#pragma config(Sensor, dgtl3,  left,                sensorQuadEncoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
  SensorValue[left] = 0;
  SensorValue[right] = 0;
    int leftEncoder = SensorValue[dgtl1];
    int rightEncoder = SensorValue[dgtl3];

I am having a problem reading the second encoder (left) value. I have manually swapped the pragma statements so that the left encoder is on the top. I am then only able to read the left encoder. Which ever encoder is not first pulses (like it is raw data) from 1 to 0. I am running this code on a Cortex (without the VEXnet “hump”). I have tried all of the sample code and they all have the same problem.

Any help would be greatly appreciated.

Sorry to hear that you’re having trouble. First, you might try updating to ROBOTC 2.32: http://www.robotc.net/download/cortex/ Make sure you update the Master and ROBOTC Firmware files once you do.

Second, try separating the two encoders a bit in the DIGITAL bank - use ports 1+2 and 5+6.

Thank you for responding.
How would I update RobotC if I have a building licence? Is it the same as just downloading the file from robotc.net?

The correct download can be found here: http://www.robotc.net/files/ROBOTCforCortexPIC_232_Building.exe

You can use the license file that was provided when the software was purchased.

Thank you. I haven’t uploaded the new firmware but I got the program installed.:slight_smile: