2020年8月17日月曜日

Attention about Rotary encoder library

 Recently, there was a inquiry that the rotary encoder did not work in the sketch of arduino.

Upon investigation, I found that the library of rotary encoders I'm using has been updated. For the new library, you need to add the instructions(r.begin();) as follows:

void setup() {
     r.begin();
    PCICR |= (1 << PCIE2);
    PCMSK2 |= (1 << PCINT18) | (1 << PCINT19);                                                                                
    sei();
}

No error will be issued without this command, but it will not work.

It may need to be changed depending on the library you are using.

If that doesn't work, try this change.

Let's enjoy homebrew.

73's      de JA2NKD    Ryuu

10 件のコメント:

JACK さんのコメント...

Will this fix the rotary encoder problem that I am having with NKDVFO22master file? Everything else works great. Do I enter this in the .ino sketch?
Thanks, Jack W6VMJ

JA2NKD さんのコメント...

Hi,Jack
try it.
There is a possibility.

73's
JA2NKD Ryuu

JACK さんのコメント...

Is anyone else having a problem with the rotary encoder on the:

NKDVFO22master file.?

It compiles nicely and looks good but I can't change the frequency. I am not sure what "master file" is and don't incorporate any of the history files.

I sure would like to figure this out?

If I add a history file to the folder is won't compile.

Jack

JA2NKD さんのコメント...

Hi,Jack
If you add "r.begin()" and get a compile error, this is not necessary.
Is the encoder a mechanical type?
Is DDS connected?

If you haven't connected a DDS, turn it on and test.

JA2NKD

JACK さんのコメント...

Ryuu,
I think I have it working now. I included the rotary.h file but not the rotary.cpp file and it now changes frequency. I have a AD9850 board on order and it should be here tomorrow. Then I will see if the VFO produces the right frequency. Maybe there is some conflict between the .cpp and the .h libraries. I hope this works. I also need to understand how to operate the RIT function. After setting a RIT number, it disappears when I go back to regular tuning. Is this correct?

Thanks for your kind help. Jack

JA2NKD さんのコメント...

Hi,Jack
It's good that the encoder works.
h is a header file and cpp is a program.
Both are required in the same folder.
It clears when RIT is turned off. You can change it to memory, but I don't feel much need.

73's
de JA2NKD Ryuu

JA0NTR さんのコメント...

最近、soltec工房の基板を使ってRF Analyzer を作成したのですが、ロータリーエンコーダーが正しく機能せず、エンコーダーを違う製品に替えたり、基板のパーツを再ハンダしたりしたのですが、うまくいかずずっと悩んでいました。
この記事を読んでやっと解決しました。
ありがとうございました。

でも、まだPowerが "nan" dBmと表示される問題が解決できません。
RF OUTからは10MHzで-9.20dBm出ていますので、DDSからは出力されていると思われます。
解決策かチェックポイントをご指導いただければ幸いです。
よろしくお願いいたします。

JA2NKD さんのコメント...

JA0NTRさん コメントありがとうございます。

海外の方からの問い合わせがあったので英語で書きました。日本語も入れたほうがよかったですね。

dBm表示でnanと出るということは、ひょっとしてAD8307の出力が出ていないのではないかと思います。Frequency Analyzerモードで入出力を直結すると上部に緑のラインが出るかどうか見てください。これが最下部になっているようであればAD8307の出力が出ていないと思います。再度この辺りをチェックしてみてください。

JA2NKD

JA0NTR さんのコメント...

JA2NKDさん
ご回答ありがとうございます。

時間が取れたらAD8307 DETECTOR基板を確認してみます。

Robert KH2BR さんのコメント...

Just go to AD7C website and use his rotary files.