1

I am (currently) parsing a PPM analog signal using an Arduino Uno R3 using the analog comparator ASCR and analog hardware interrupts using AIN0 and AIN1. I am applying a specific negative comparison voltage using a linear voltage regulator on AIN0 and the signal on AIN1.

Code snippets:

setup

  ACSR  = B00011011;

outside other closures

ISR(ANALOG_COMP_vect) {
   CRCArduinoPPMChannels::INT0ISR();
}

I am trying to move this project to an Arduino (compatible) Pro Micro from SparkFun. The datasheet specifies AIN0 on ATmega32u4 pin 1 but do not see a reference to AIN1.

The datasheet outlines use of the analog comparator on page 289:

AIN+ can be connected either to the AIN0 (PE6) pin, or to the internal Bandgap reference. AIN- can only be connected to the ADC multiplexer.

I have connected the signal to Arduino pin 7, the comparison voltage to Arduino pin 20 (analog 2) and set the following options of the ADMUX register:

ADMUX = B11000101;

The interrupts trigger but the comparator voltage (AIN-) is not being observed. Any help would be appreciated.

  • 1
    Did you forget to set ACME? – Ignacio Vazquez-Abrams Nov 5 '15 at 2:03
  • 2
    Yes! Setting ACME bit to 1 and ADEN to 0 did it. Thank you – Jason Nov 5 '15 at 2:25
  • 3 years 9 months later, do you still happen to have your code handy by chance, would you mind to share the whole analog comparator setup please? (This is of course not an answer, sorry, I'm unable to just write a comment, I get "You must have 50 reputation to comment".) – Nicolas Aug 29 at 23:17
  • Actually... I do. github.com/jjluebke/PigeonPPM/blob/master/PigeonPPM.ino – Jason Aug 31 at 0:50
1

AIN- won't be connected to the ADC mux unless ACME is set and ADEN is cleared. Don't forget to do so.

protected by VE7JRO Aug 29 at 23:21

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.