knocked out Optical Shaft Encoder

I’m trying to use three ultrasonic range finders (front, left, right) and two optical shaft encoders (left and right). The two encoders worked fine when I used the robotC sample program. I then tried to add my three ultrasonic range finders to the sample program, and then the left encoder would only report a 0 or 1. After playing around a bit, I found it is only caused by the “front” range finder. If I remove the code #pragma config(Sensor, dgtl9, sonarF, sensorSONAR_mm)], but keep the sensor plugged in, the left encoder works. I’ve tried moving the front senor to different digital ports, but it still causes the problem.
Why is the front ultrasonic range finder code knocking out my left encoder?

Here is the motor and senor setup:
#pragma config(Sensor, dgtl1, rightEncoder, sensorQuadEncoder)
#pragma config(Sensor, dgtl3, leftEncoder, sensorQuadEncoder)
#pragma config(Sensor, dgtl5, sonarRight, sensorSONAR_mm)
#pragma config(Sensor, dgtl7, sonarLeft, sensorSONAR_mm)
#pragma config(Sensor, dgtl9, sonarF, sensorSONAR_mm)
#pragma config(Motor, port1, leftMotor, tmotorServoContinuousRotation, openLoop, reversed)
#pragma config(Motor, port10, rightMotor, tmotorServoContinuousRotation, openLoop)

Thanks for the help. I appreciate it.

Stop using either digital port 4 or digital port 10 and you will be fine (eg. move the sonar from ports 9&10 to 11&12). This is a known defect in the cortex (not a ROBOTC problem). I will find a link to a post later that explains in detail.

Yes! That worked perfectly. I never would have figured that out.