I was using 4 encoders in interrupt ports 1 through 4. They work fine 1 at a time (preset, start, read, stop). However if I start one encoder and read back at some interval and then start another encoder, when I read back from the second encoder, the first one will no longer increment.
Can you use more then one encoder at the same time?
**If the software/code that you write is not written correctly – it has bugs, you can prevent the units from working correctly or prevent yourself from seeing the correct data. **
OK. Software bugs would certainly cause a problem. And I cannot say there are no bugs, since “there is ALWAYS one more bug”.
It seemed that the problem occurred only when I started using 2 motors at MAX SPEED. The 2 motors were attached to 2 encoders. One encoder stopped reading an incremented count when I started reading from the second encoder.
Question 1: Is there a priority for the interrupt inputs? For example, does interrupt port 2 take priority over interrupt port 1 if port1 1 tries to interrupt while port 2’s interrupt routine is still running.
Question 2: I think the interrupt port and interrupt routine limits the rate of sensing an encoder input to > 1ms increments. Is that true?
I will have to do more experiments and calculations to see if the above is or isn’t part of the problem.
Actually I am using EasyC 2.0. It seems your responses are referring to MPLAB software capabilities (or even ROBOTC, I do no know).
Since I was using EasyC 2.0, I do not think I have control over interrupt priorities, and I am not writing interrupt routines (just Set, Start, Get, StopEncoder commands).
I looked at the encoder spec that said an encoder could handle up to 1700 pulses per second, so 2 encoders at about 400 pulses per second should have been OK.
So 2 questions:
1) Does my use of EasyC change any of your responses?
2) I purchased and looked at MPLAB software. I could compile, execute and debug non vex programs. How do I get more info on how to use it to program the vex robot sensors/motors, etc?
**1) We can not answer questions about easyC, please post in the easyC Section.
2) Look at the Vex Starter Code and the Vex Sensor Test Code for examples located on our Support Page.
I would also post your question(s) in the General Section, there may be Vex Users that have done what you are trying to do that can help you.**