开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: Help with rotary encoder code, please, anyone?


Jack Purdum
 

That code is fairly common and I used it in my first encoder article in QRP Quarterly, which I have attached for those who might be interested:


PCICR |= (1 << PCIE2); // Pin Change Interrupt Enable 2 to set
// Pin Change Interrupt Control Register
PCMSK2 |= (1 << PCINT18) | (1 << PCINT19); // Use pins 2 and 3 for
// the control mask
sei(); // Set interrupts flag

Direct port manipulation is slightly more efficient than using AttachInterrupt(), but the function is merely a wrapper function that hides the bit masking the code above does. The other advantage of the function over bit masking is that you don't have to worry about setting the mask registers yourself. All you have to do is get the pin number correct. The wrapper code figures out the proper interrupt vector.

Jack, W8TEE


From: Michael Hagen <motdog@...>
To: [email protected]
Sent: Sunday, July 30, 2017 7:14 PM
Subject: Re: [BITX20] Help with rotary encoder code, please, anyone?

It came from an example.? It worked immediately so I left it?
It deals with the registers directly.
So, sorry I can't answer your question, and it is a good one!
I guess we could find the code in AttachInterrupt in the library to see what it does?
I added #defines and made version 1.09 into a conditional assembly file.?? That was what I was trying to explain, not
to have a fully working version.
I think any version could be now done easily.? I have 4 line LCDs, but not in my nice radio case.
I think that would be the answer so all the new features that use line 2 would not get written over by the Step display.
Or, I will have to share line 2 with the step display.? It would be easier by just adding lines.
Mike
?
On 7/30/2017 3:51 PM, Norberto Modanesi wrote:
Hi Don:
Why do you use PCICR |= (1 << PCIE2);//Interrupt setup ?to enable interrupt insted of AttachInterrupt?
73 - LU5DNM
?
Norberto Modanesi
San Nicolás

_._,_._,_


Join [email protected] to automatically receive all group messages.