When I try to use more than one sonar sensor on my cortex, it appears that I loose other channels. Had the system set up with two sonars and if I had them both plugged in I would lose one of my encoders. Has anyone else seen a problem like this and is there a fix that would allow me to use more than one sonar at a time?
Please go into more detail.
Are you using easyC or ROBOTC?
What ports did you use for the single sonar sensor?
What ports did you use when you connected two?
I have successfully connected almost all of the VEX sensors (excluding gyroscope) to one robot (just for fooling around and testing program concepts). It IS possible.
There is a problem using port 4 and port 10 at the same time with certain types of sensor, perhaps that’s the issue.
Could you please be more specific? I’d like to plan against that in the future.
This is an issue I have never tested although there is some anecdotal evidence.
The problem is with the interrupt structure of the cortex. This diagram shows how external interrupts are setup.
PA0, PA1 etc. are the external IO pins on the cortex, you can see that a single interrupt can be generated from one of the seven possible inputs to the mux. EXTI0 can be one of PA0, PB0 etc.
Digital 4 on the cortex corresponds to PC7, digital 10 corresponds to PE7, this means that they can not both be selected as an external interrupt source. No other digital inputs have this issue.
Some types of sensor need interrupts, specifically quad encoders and (probably) sonar inputs. Other types of sensor like switches and leds do not. So there is (and again I stress I have never found time to test this) potentially an issue if you try and use that type of sensor on both digital 4 and digital 10.
Now I guess I have to go off and test it…
Thanks for the information. I will take this into account when wiring things up.
You cannot use the quad encoders & sonar (any 2 wire sensors) on digital port 10 because of what JPearson said. You can however use singe wire digital sensors like the touch & limit switches on that port. I wasn’t aware of digital port 4.
Oops Sorry. JPearman
Thanks for the help. I’ll try to avoid posts 4 and 10 for encoders and sonar. I believe my setup was 4 for encoder and 10 for sonar. I’mm gonna go back tomorrow and try to move the senors to different ports. Avoiding 4 and 10. Would that be a good place for potentiometer or limit switches?
Just to be clear, you don’t need to avoid both, only one or the other. So if you have the encoder in say 3&4, don’t try and use 10 for another encoder.
The potentiometer needs to be in an analog port not a digital port. A limit switch can go anywhere.