Arduino Nano Every - Interrupts

Hi,

I like to know if there is a change with the interrupts from Nano to Nano Every? I could not find anything in the attachInterrupt help and also the chip documentation is not helpful for me as a beginner. Actually I only know that the nano supports interrupts on D2 and D3 only.

I like to immediatly react on a change on a digital pin which is a error input. It should directly change another digital pin. Thats because I like to use interrupts. Btw. I read something in the documentation that looks like interrupts are also available for analog pins called events???

The only note I could fine in the data sheet is:
in names are of type Pxn, with x being the PORT instance (A,B,C, …) and n the pin number. Notation forsignals is PORTx_PINn. All pins can be used as event input.2. All pins can be used for external interrupt, where pins Px2 and Px6 of each port have full asynchronousdetection.

Regards,
Nils

Hello Nils, I have testet the interrupt with the digital pins 2 ... 5, all works fine.

The kernel function has a little change (3 parameters), thats all.

attachInterrupt(iPin,service,FALLING); // Falling edge at iPin

The 3rd parameter defines the type (RISING, FALLING, CHANGE)

On classic nano, there are "external interrupts" that work on pins 2 and 3 (int0, int1) and attachInterrupt, plus PCINTs on all pins.

On nano every, there is only one kind of interrupt, it works on all pins (but only the full async pins can wake from sleep on rising/falling - the rest can only wake from sleep on low level or change), and can be used with attachIntereupt. Or can be done manually if you prefer (I consider attachInterrupt to be an abomination)

@NILSRO

Other post/duplicate DELETED Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Please READ THIS POST to help you get the best out of the forum.

Bob

DrAzzy: On classic nano, there are "external interrupts" that work on pins 2 and 3 (int0, int1) and attachInterrupt, plus PCINTs on all pins.

On nano every, there is only one kind of interrupt, it works on all pins (but only the full async pins can wake from sleep on rising/falling - the rest can only wake from sleep on low level or change), and can be used with attachIntereupt. Or can be done manually if you prefer (I consider attachInterrupt to be an abomination)

Perfect, that the information I need. Many thanks. Do you know if it is possible to set an interrupt on an analog input like it is send if voltage is below 4V?

@Bob: Sorry, missed that you moved my first post to this forum and thought it was somehow deleted or not posted.

Cheers, Nils

Do you know if it is possible to set an interrupt on an analog input like it is send if voltage is below 4V?

You can do this by using the analog comparator with an internally generated reference voltage. Have a look at the MegaCoreX Comparator library.

MegaCoreX is a 3rd party addon to Arduino IDE, and Arduino Nano Every is supported. It brings more features to the table, and currently supports all megaAVR-0 chips.

If you look at the Comparator interrupt example, you can easily modify it to trigger when the voltage crosses a certain level. Basically all you need to do is to change the reference to ref::vref_4v, and tune the dacref value to match exactly 4V.

If you're not sure what pins to connect to, you can have a look at the MegaCoreX Arduino Nano Every pinout diagram.