Library conflicts

Hello,

I have the following two questions regarding the Pololu AVR C Library.

  1. I want to use the QTR functions of the PololuQTRSensorsRC class together with the Motor Control Functions. I have noticed that both utilize Timer2 to time the sensor pulses and produce PWM respectively. Will I have a conflict in that case?

  2. I am reading two wheel encoders in port C (PC2,3,4,5) using the encoder functions of Pololu library and at the same time I need to utilize the PIN CHANGE interrupts for another functionality at ports B and D. As far as I noticed the library uses all three pin change interrupt vectors (PCINT0, PCINT1, PCINT2). Theoretically I could disable PCINT0 and PCINT2 manually from the library. Is it enough if I simply comment the PCINT0 and PCINT2 interrupt vectors in PololuWheelEncoders.c implementation?

Thank you in advance,

Akis

It seems likely you will.

It seems likely that will be enough, but I haven’t used it myself, so I can’t say for sure.

I find that, when I stray from the “do one thing that already has a library” path, I end up with more robust code by just taking ownership of the AVR microcontroller myself. I write code in straight C++ using avr-gcc, and drive the peripherals (timers, interrupts, etc) myself for those cases, and program using a programmer rather than the serial link. I don’t know if that’s something you’d want to consider, but it works great for me :slight_smile:

Thx for the reply,

Actually, I am not quite sure if that is the case in my first question. As far as I understand, the Pololu 3pi robot uses 5 QTR-RC reflective sensors together with the library’s set_motors command. So there must be a way to combine these two!

I looking forward to hear your thoughts.

Akis

Hello, Akis. There will not be a conflict. As you said, the 3pi uses both of those libraries. The libraries use Timer 2 in a compatible way.

No, you would also have to recompile the library and reinstall it into the avr/lib folder of whatever toolchain you are using. As a first step, you could try running “make” in the libpololu-avr directory and see if that works.

–David

Thank you David. That helped! :slight_smile:

Hello again and Happy New Year to everyone,

I have just tried to recompile the library today (with make and make clean command at libpololu-avr directory) and I am getting the following messages:

I see that it gives me some error messages and I am not sure if the recompilation has been done properly. From what I noticed, I receive exactly the same messages no matter if I change the PololuWheelEncoders.c implementation or not.

Should I proceed with the library installation or should I try something else first?

Thank you in advance,

Akis

Hello, Akis.

You are using a three-year-old version of the library. Could you download the latest one and try again? They are available in the “Download Instructions” section of the Pololu AVR C/C++ Library User’s Guide.

–David

Hello David,

I have downloaded and installed the latest Pololu C/C++ library as you instructed me. Unfortunately, if I simply comment the PCINT0 and PCINT2 interrupt vectors in PololuWheelEncoders.c implementation and remake the library I am getting the following errors:

Could you please provide me some instructions on how me to keep only the PCINT1 interrupt vector active in the library, in order to use the other two vectors in my own projects?

Furthermore, Up until now I was using the AVRSudio 4. I have now installed the Atmel Studio 6, but I see that this is not compatible with the old Pololu programmer https://www.pololu.com/catalog/product/740, which I am using. Is there any firmware update for the 740 programmer in order to work with Studio 6?

Thank you,

Akis

OK, I solved the problem with remaking the library! Although I haven’t test it in my application yet, It compiles ok and I am sure it will be fine.

If you could give me some info regarding my Atmel Studio 6 question, I would be grateful!

Thx a lot!

Akis

I am glad you were able to figure out the problem. We have not updated our older programmer for Atmel Studio 6. You have the option to use Atmel Studio 6 to generate the HEX file and then use a different program such as AVRDUDE or AVR Studio 4 to perform the programming.

–David