Sensor Conflict

We are using 2 sonars and 2 quadrature encoders on our Cortex with RobotC for our digital sensors.

We cannot get all 4 to work and have tried every port combination we can think of. We have moved the encoders one at a time, as well as the sonars with no luck. Does anyone know of a solution for this? If all else fails we will just hook up one cable per side and use the quadratures as regular encoders. We can get both sonars and 1 encoder working, or both encoders and 1 sonar.

Which ports are you trying to use? The only restriction I know of is that Digital 4 and digital 10 cannot both be used as interrupts.

Thanks once again! We moved the sonars to 1&2 and 7&8 and now everything works as it should.

Ok, glad you sorted it out. I just tried this and it worked ok.

#pragma config(Sensor, dgtl1,  Quad_1,         sensorQuadEncoder)
#pragma config(Sensor, dgtl3,  Quad_2,         sensorQuadEncoder)
#pragma config(Sensor, dgtl5,  Sonar_1,        sensorSONAR_cm)
#pragma config(Sensor, dgtl7,  Sonar_2,        sensorSONAR_cm)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()

Even with this you need to be careful with port 10, sometimes even when it’s used for say an LED it can affect things in port 4.