Teensy 3.6 interrupt on Analog pins

Status
Not open for further replies.

marcopolo

New member
Hello guys,

I'm new to this forum and also a bit new to µC programming.
I'm using teensy for quite a bit now, since this device is much more interesting than an arduino.
Now i'm making an school project and draw and produced a PCB. There I wired one of my pushbuttons to analog pin 21, since the documentation told me all pins are interruptable.
But now I try to make this work, but it doesn't. How can I use these analog pins as interrupts? I have no idea where to find this.

Thanks!
Marco
 
The analog to digital converter in the Kinetis K66 microcontroller has an analog comparator feature that can be set up in a variety of ways to generate a conversion complete interrupt only when it recognizes a reading with the characteristics defined in the comparator registers. See the ADCx_SC2 register, bits ACFE, ACFGT and ACREN, and the supporting section on "Automatic compare function".

Each ADC can be set up to perform conversions continuously, depending only on ADC settings. Alternatively, ADC conversions can be triggered by the Programmable Delay Block when the application calls for well-defined, carefully timed, or time-synchronized readings.

There are details to be worked out, these parts are very flexible and have tons of settings.

The manual is here: https://www.pjrc.com/teensy/K66P144M180SF5RMV2.pdf
 
As mentioned only digital pins have interrupts as shown on the front of the card:
card9a_rev1.png


There are a few IO pins on the T3.6 that are not digital, which includes the one you mentioned as well as A10, A11, A22.

As mentioned you might be able to do some tricks with Analog, to create interrupts, but that also could depend on things like how the buttons are wired up?
That is often times with buttons, one might connect the other side of a button to GND or +3.3v and then initialize the sate of the button using the internal Pull up or Pull Down resistors.
pinmode(pin, INPUT_PULLUP)... And then the IO pin is not just floating and you can get the either High or Low transistiions... But with the A21, you can not do the INPUT_PULLUP (or down)...
So they would require external resistors to give you a value and not just have them floating...

Also not sure about using the Automatic Compare and Interrupts with these pins as that may then require you to setup one of the ADCs to always be configured to do that for that pin, and I have no idea of what other analog things your code may require. Like reading in Sliders or Pots or ...
 
Status
Not open for further replies.
Back
Top