アセンブラからコンパイラに移行することにしましたが、今まで愛用していたTiny26ではメモリー容量(プログラム2KB)の関係でコンパイラ使用はちと辛い。そこでMega88を使用してみることにしました。プログラムメモリーは4倍に、最高クロックは20MHzに増加です。RAMもたっぷりあるので、コンパイラ用にはいいですね。T/Cも3本、2本のTiny26に比べればかなり楽ができます。でも、パッケージが、28pinなので20pinのTiny26に比べ基板がだいぶ大きくなってしまいます。

使用上で気がついたことをメモっておきます。

I decided to move from assembler to complier in AVR programming. I have used mainly AVR Tiny26 for my projects. However the program memory size is limited in Tiny26 to 2KB and bit too small for assembler programming. So I go to Mega88 instead. Mega88 has four time larger program memory, higher clock frequency of 20MHz, plenty of RAM and one more timer/counter. It sounds great for compiler programming. Only drawback is chip size. 28pin DIL is much larger than 20pin of Tiny26.

I will make memorandum on application of Mega88.

クロック周波数

Mega88のヒューズビット、CKDIV8はなぜかデフォルトでシステムクロック8分周設定になっています。CPU動作が想定よりやたらに遅く、さんざん悩んだ挙句やっと見つけました。これを1にセットすれば8分周はなくなります。

Clock Frequency

Fuse bit “CKDIV8” of Mega88 is set for dividing the clock by 8 as default. At first attempt the CPU did not run at intended speed at all, much slower. I looked around the manual and finally found this. “CKDIV” should be set to one to disable clock division.

PWMシミュレーション

AVR Studio 4.13のシミュレータではT/CのPWMモードが全く機能していません。

Simulator of AVR Studio 4.13 does not work at all for PWM mode of any T/C.

T/CをPWMモードで使った場合、オーバーフロー割り込みを有にしてもシミュレータでは割り込み動作がちゃんと機能しません。しかし実機で確認にしたところちゃんと割り込みはかかりました。これをうまく使えばPWMと定時割り込みのT/Cを共用できるので、ひとつT/Cを別の用途に使えます。T/Cは貴重なリソースなので助かります。

T/C Overflow Interruption

When a T/C is used for PWM the overflow interruption does not work on simulator. However on actual chip this function works. By using this one T/C can serve both for PWM and periodic time interruption saving one T/C.

Usually I set fuse bits as left.

通常、フューズビットは左のように設定しています。


 

 
inserted by FC2 system