Error compiling for board ATtiny1604 - Interrupts are unknown for this board

Hi
I am new to the community first time to post here.
I have a problem with my tiny IC ATtiny1604 and encoder.h (1.4.2 version) library, sems like no support for ATtiny1604 IC
There is any fix ?
This is my error message when i am trying to flash with Arduino UNO:

C:\Program Files (x86)\Arduino\libraries\Encoder-1.4.2/utility/interrupt_pins.h:334:2: error: #error "Interrupts are unknown for this board, please add to this code"
#error "Interrupts are unknown for this board, please add to this code"
^~~~~
C:\Program Files (x86)\Arduino\libraries\Encoder-1.4.2/utility/interrupt_pins.h:337:2: error: #error "Encoder requires interrupt pins, but this board does not have any :("
#error "Encoder requires interrupt pins, but this board does not have any :("
^~~~~
C:\Program Files (x86)\Arduino\libraries\Encoder-1.4.2/utility/interrupt_pins.h:338:2: error: #error "You could try defining ENCODER_DO_NOT_USE_INTERRUPTS as a kludge."
#error "You could try defining ENCODER_DO_NOT_USE_INTERRUPTS as a kludge."
^~~~~
exit status 1
Error compiling for board ATtiny3224/1624/1614/1604/824/814/804/424/414/404/214/204.

Tnx you verry much!!

The ENCODER_DO_NOT_USE_INTERRUPTS "kludge" mentioned in the error message is demonstrated by the library's "NoInterrupts" example sketch, which you can also see here:

1 Like

@tr1ppo, your topic has been moved to a more suitable location on the forum.

1 Like

Tnx for your reply @pert, you rly help me alot!
if I enable the ENCODER_DO_NOT_USE_INTERRUPTS, the performace of encoder will not be affected ? ex missing steps or increment a step instead of decrement that step.
I am planning to using a RKJXT1F42001 4-directional Stick Switch (with Encoder + Center-push Function) to control a Bluetooth volume and to skip songs..
I am thinking to use ATtiny841 instead of ATtiny1604 to use internal interrupt feature for a better encoder performance, but i am not sure if that is worth.
I will try today to use ENCODER_DO_NOT_USE_INTERRUPTS to see how is work.

It can definitely harm the performance. Without interrupts, you will need to make sure your code is polling myEnc.read() frequently enough to catch all the encoder pulses. How difficult or possible that is will depend on what else you need to do in the sketch code.

Fortunately, it sounds like your application will not be super demanding of performance since the encoder will not be turned so rapidly as it could be on a motor and also missing some pulses might not be such a serious problem.

It's a shame that Paul doesn't merge PR's to add support for additional processors (there are a bunch for other ATtiny parts rotting in the PR section of the repo). I've had one open for nearly a year against one of his other repos! If he actually merged PRs I'd add the interrupt vectors for tiny 0/1/2, mega 0 and Dx-series....

I have a question about ATtiny841. I see that he is in the library Econder.h with only one pin (no 9), and Arduino UNO have 2 pins (2,3)
what pins i should use to work with the following code:

#include <Encoder.h>

int oldPosition = 0;
Encoder myEnc(9, ?);

void setup ()
{
Serial.begin(9600);
}

void loop()
{
long newPosition = myEnc.read();
if (newPosition != oldPosition)
{
oldPosition = newPosition;
Serial.println(newPosition);
}
}

The ATtiny841 data sheet tells us it only has one external interrupt, INT0. That is on physical pin 3 (for the SOIC package) which is PB1 and Arduino pin 9.

I do not know if the Encoder library allows pin change interrupts, which can be any of the 12 pins.

If you want to use an external crystal, it uses PB1 implying you cannot use INT0.

Hope that helps?
Willem.