2021年3月7日日曜日

59円FMラジオのプログラム更新中

例年のことですが、花粉症がひどくて色々と低空飛行中です。目はかゆいし、鼻はつまり、熱っぽくて倦怠感が続いています。仕事は仕方ないから気力を振り絞っていますが、仕事以外のことはやる気がでません。寝ても疲れがとれない。それでも今年はテレワークと自粛生活で外出しなくて済んでいるのでまだよいほうです。
 
そんな中、59円チューナモジュールを使ったFMラジオ のプログラムを局のスキャンできるようにバージョンアップしようと考えましたが、スキャンして見つけたらプリセットしたいとか、プリセットした局を順次切り替えたいとか、色々と欲がでてきました。しかし、スイッチ2個で操作させるには長押しとか2個同時押しとか、UIが複雑になり使いこなせそうにありません。で、やっぱりスキャンするのはやめました。プログラムに局情報を書き込む従来手法のままです。
 
ただ、以前周波数からバイナリ値に変換するところの質問を受けたことがあるので、変換テーブル(PICアセンブラソース)を作りました。ソース内の局定義を差し替えればOKのはず。
	DT      "        "," 76.0MHz",B'00000000',B'00011000'
	DT      "        "," 76.1MHz",B'00000000',B'01011000'
	DT      "        "," 76.2MHz",B'00000000',B'10011000'
	DT      "        "," 76.3MHz",B'00000000',B'11011000'
	DT      "        "," 76.4MHz",B'00000001',B'00011000'
	DT      "        "," 76.5MHz",B'00000001',B'01011000'
	DT      "        "," 76.6MHz",B'00000001',B'10011000'
	DT      "        "," 76.7MHz",B'00000001',B'11011000'
	DT      "        "," 76.8MHz",B'00000010',B'00011000'
	DT      "        "," 76.9MHz",B'00000010',B'01011000'
	DT      "        "," 77.0MHz",B'00000010',B'10011000'
	DT      "        "," 77.1MHz",B'00000010',B'11011000'
	DT      "        "," 77.2MHz",B'00000011',B'00011000'
	DT      "        "," 77.3MHz",B'00000011',B'01011000'
	DT      "        "," 77.4MHz",B'00000011',B'10011000'
	DT      "        "," 77.5MHz",B'00000011',B'11011000'
	DT      "        "," 77.6MHz",B'00000100',B'00011000'
	DT      "        "," 77.7MHz",B'00000100',B'01011000'
	DT      "        "," 77.8MHz",B'00000100',B'10011000'
	DT      "        "," 77.9MHz",B'00000100',B'11011000'
	DT      "        "," 78.0MHz",B'00000101',B'00011000'
	DT      "        "," 78.1MHz",B'00000101',B'01011000'
	DT      "        "," 78.2MHz",B'00000101',B'10011000'
	DT      "        "," 78.3MHz",B'00000101',B'11011000'
	DT      "        "," 78.4MHz",B'00000110',B'00011000'
	DT      "        "," 78.5MHz",B'00000110',B'01011000'
	DT      "        "," 78.6MHz",B'00000110',B'10011000'
	DT      "        "," 78.7MHz",B'00000110',B'11011000'
	DT      "        "," 78.8MHz",B'00000111',B'00011000'
	DT      "        "," 78.9MHz",B'00000111',B'01011000'
	DT      "        "," 79.0MHz",B'00000111',B'10011000'
	DT      "        "," 79.1MHz",B'00000111',B'11011000'
	DT      "        "," 79.2MHz",B'00001000',B'00011000'
	DT      "        "," 79.3MHz",B'00001000',B'01011000'
	DT      "        "," 79.4MHz",B'00001000',B'10011000'
	DT      "        "," 79.5MHz",B'00001000',B'11011000'
	DT      "        "," 79.6MHz",B'00001001',B'00011000'
	DT      "        "," 79.7MHz",B'00001001',B'01011000'
	DT      "        "," 79.8MHz",B'00001001',B'10011000'
	DT      "        "," 79.9MHz",B'00001001',B'11011000'
	DT      "        "," 80.0MHz",B'00001010',B'00011000'
	DT      "        "," 80.1MHz",B'00001010',B'01011000'
	DT      "        "," 80.2MHz",B'00001010',B'10011000'
	DT      "        "," 80.3MHz",B'00001010',B'11011000'
	DT      "        "," 80.4MHz",B'00001011',B'00011000'
	DT      "        "," 80.5MHz",B'00001011',B'01011000'
	DT      "        "," 80.6MHz",B'00001011',B'10011000'
	DT      "        "," 80.7MHz",B'00001011',B'11011000'
	DT      "        "," 80.8MHz",B'00001100',B'00011000'
	DT      "        "," 80.9MHz",B'00001100',B'01011000'
	DT      "        "," 81.0MHz",B'00001100',B'10011000'
	DT      "        "," 81.1MHz",B'00001100',B'11011000'
	DT      "        "," 81.2MHz",B'00001101',B'00011000'
	DT      "        "," 81.3MHz",B'00001101',B'01011000'
	DT      "        "," 81.4MHz",B'00001101',B'10011000'
	DT      "        "," 81.5MHz",B'00001101',B'11011000'
	DT      "        "," 81.6MHz",B'00001110',B'00011000'
	DT      "        "," 81.7MHz",B'00001110',B'01011000'
	DT      "        "," 81.8MHz",B'00001110',B'10011000'
	DT      "        "," 81.9MHz",B'00001110',B'11011000'
	DT      "        "," 82.0MHz",B'00001111',B'00011000'
	DT      "        "," 82.1MHz",B'00001111',B'01011000'
	DT      "        "," 82.2MHz",B'00001111',B'10011000'
	DT      "        "," 82.3MHz",B'00001111',B'11011000'
	DT      "        "," 82.4MHz",B'00010000',B'00011000'
	DT      "        "," 82.5MHz",B'00010000',B'01011000'
	DT      "        "," 82.6MHz",B'00010000',B'10011000'
	DT      "        "," 82.7MHz",B'00010000',B'11011000'
	DT      "        "," 82.8MHz",B'00010001',B'00011000'
	DT      "        "," 82.9MHz",B'00010001',B'01011000'
	DT      "        "," 83.0MHz",B'00010001',B'10011000'
	DT      "        "," 83.1MHz",B'00010001',B'11011000'
	DT      "        "," 83.2MHz",B'00010010',B'00011000'
	DT      "        "," 83.3MHz",B'00010010',B'01011000'
	DT      "        "," 83.4MHz",B'00010010',B'10011000'
	DT      "        "," 83.5MHz",B'00010010',B'11011000'
	DT      "        "," 83.6MHz",B'00010011',B'00011000'
	DT      "        "," 83.7MHz",B'00010011',B'01011000'
	DT      "        "," 83.8MHz",B'00010011',B'10011000'
	DT      "        "," 83.9MHz",B'00010011',B'11011000'
	DT      "        "," 84.0MHz",B'00010100',B'00011000'
	DT      "        "," 84.1MHz",B'00010100',B'01011000'
	DT      "        "," 84.2MHz",B'00010100',B'10011000'
	DT      "        "," 84.3MHz",B'00010100',B'11011000'
	DT      "        "," 84.4MHz",B'00010101',B'00011000'
	DT      "        "," 84.5MHz",B'00010101',B'01011000'
	DT      "        "," 84.6MHz",B'00010101',B'10011000'
	DT      "        "," 84.7MHz",B'00010101',B'11011000'
	DT      "        "," 84.8MHz",B'00010110',B'00011000'
	DT      "        "," 84.9MHz",B'00010110',B'01011000'
	DT      "        "," 85.0MHz",B'00010110',B'10011000'
	DT      "        "," 85.1MHz",B'00010110',B'11011000'
	DT      "        "," 85.2MHz",B'00010111',B'00011000'
	DT      "        "," 85.3MHz",B'00010111',B'01011000'
	DT      "        "," 85.4MHz",B'00010111',B'10011000'
	DT      "        "," 85.5MHz",B'00010111',B'11011000'
	DT      "        "," 85.6MHz",B'00011000',B'00011000'
	DT      "        "," 85.7MHz",B'00011000',B'01011000'
	DT      "        "," 85.8MHz",B'00011000',B'10011000'
	DT      "        "," 85.9MHz",B'00011000',B'11011000'
	DT      "        "," 86.0MHz",B'00011001',B'00011000'
	DT      "        "," 86.1MHz",B'00011001',B'01011000'
	DT      "        "," 86.2MHz",B'00011001',B'10011000'
	DT      "        "," 86.3MHz",B'00011001',B'11011000'
	DT      "        "," 86.4MHz",B'00011010',B'00011000'
	DT      "        "," 86.5MHz",B'00011010',B'01011000'
	DT      "        "," 86.6MHz",B'00011010',B'10011000'
	DT      "        "," 86.7MHz",B'00011010',B'11011000'
	DT      "        "," 86.8MHz",B'00011011',B'00011000'
	DT      "        "," 86.9MHz",B'00011011',B'01011000'
	DT      "        "," 87.0MHz",B'00011011',B'10011000'
	DT      "        "," 87.1MHz",B'00011011',B'11011000'
	DT      "        "," 87.2MHz",B'00011100',B'00011000'
	DT      "        "," 87.3MHz",B'00011100',B'01011000'
	DT      "        "," 87.4MHz",B'00011100',B'10011000'
	DT      "        "," 87.5MHz",B'00011100',B'11011000'
	DT      "        "," 87.6MHz",B'00011101',B'00011000'
	DT      "        "," 87.7MHz",B'00011101',B'01011000'
	DT      "        "," 87.8MHz",B'00011101',B'10011000'
	DT      "        "," 87.9MHz",B'00011101',B'11011000'
	DT      "        "," 88.0MHz",B'00011110',B'00011000'
	DT      "        "," 88.1MHz",B'00011110',B'01011000'
	DT      "        "," 88.2MHz",B'00011110',B'10011000'
	DT      "        "," 88.3MHz",B'00011110',B'11011000'
	DT      "        "," 88.4MHz",B'00011111',B'00011000'
	DT      "        "," 88.5MHz",B'00011111',B'01011000'
	DT      "        "," 88.6MHz",B'00011111',B'10011000'
	DT      "        "," 88.7MHz",B'00011111',B'11011000'
	DT      "        "," 88.8MHz",B'00100000',B'00011000'
	DT      "        "," 88.9MHz",B'00100000',B'01011000'
	DT      "        "," 89.0MHz",B'00100000',B'10011000'
	DT      "        "," 89.1MHz",B'00100000',B'11011000'
	DT      "        "," 89.2MHz",B'00100001',B'00011000'
	DT      "        "," 89.3MHz",B'00100001',B'01011000'
	DT      "        "," 89.4MHz",B'00100001',B'10011000'
	DT      "        "," 89.5MHz",B'00100001',B'11011000'
	DT      "        "," 89.6MHz",B'00100010',B'00011000'
	DT      "        "," 89.7MHz",B'00100010',B'01011000'
	DT      "        "," 89.8MHz",B'00100010',B'10011000'
	DT      "        "," 89.9MHz",B'00100010',B'11011000'
	DT      "        "," 90.0MHz",B'00100011',B'00011000'
	DT      "        "," 90.1MHz",B'00100011',B'01011000'
	DT      "        "," 90.2MHz",B'00100011',B'10011000'
	DT      "        "," 90.3MHz",B'00100011',B'11011000'
	DT      "        "," 90.4MHz",B'00100100',B'00011000'
	DT      "        "," 90.5MHz",B'00100100',B'01011000'
	DT      "        "," 90.6MHz",B'00100100',B'10011000'
	DT      "        "," 90.7MHz",B'00100100',B'11011000'
	DT      "        "," 90.8MHz",B'00100101',B'00011000'
	DT      "        "," 90.9MHz",B'00100101',B'01011000'
	DT      "        "," 91.0MHz",B'00100101',B'10011000'
	DT      "        "," 91.1MHz",B'00100101',B'11011000'
	DT      "        "," 91.2MHz",B'00100110',B'00011000'
	DT      "        "," 91.3MHz",B'00100110',B'01011000'
	DT      "        "," 91.4MHz",B'00100110',B'10011000'
	DT      "        "," 91.5MHz",B'00100110',B'11011000'
	DT      "        "," 91.6MHz",B'00100111',B'00011000'
	DT      "        "," 91.7MHz",B'00100111',B'01011000'
	DT      "        "," 91.8MHz",B'00100111',B'10011000'
	DT      "        "," 91.9MHz",B'00100111',B'11011000'
	DT      "        "," 92.0MHz",B'00101000',B'00011000'
	DT      "        "," 92.1MHz",B'00101000',B'01011000'
	DT      "        "," 92.2MHz",B'00101000',B'10011000'
	DT      "        "," 92.3MHz",B'00101000',B'11011000'
	DT      "        "," 92.4MHz",B'00101001',B'00011000'
	DT      "        "," 92.5MHz",B'00101001',B'01011000'
	DT      "        "," 92.6MHz",B'00101001',B'10011000'
	DT      "        "," 92.7MHz",B'00101001',B'11011000'
	DT      "        "," 92.8MHz",B'00101010',B'00011000'
	DT      "        "," 92.9MHz",B'00101010',B'01011000'
	DT      "        "," 93.0MHz",B'00101010',B'10011000'
	DT      "        "," 93.1MHz",B'00101010',B'11011000'
	DT      "        "," 93.2MHz",B'00101011',B'00011000'
	DT      "        "," 93.3MHz",B'00101011',B'01011000'
	DT      "        "," 93.4MHz",B'00101011',B'10011000'
	DT      "        "," 93.5MHz",B'00101011',B'11011000'
	DT      "        "," 93.6MHz",B'00101100',B'00011000'
	DT      "        "," 93.7MHz",B'00101100',B'01011000'
	DT      "        "," 93.8MHz",B'00101100',B'10011000'
	DT      "        "," 93.9MHz",B'00101100',B'11011000'
	DT      "        "," 94.0MHz",B'00101101',B'00011000'
	DT      "        "," 94.1MHz",B'00101101',B'01011000'
	DT      "        "," 94.2MHz",B'00101101',B'10011000'
	DT      "        "," 94.3MHz",B'00101101',B'11011000'
	DT      "        "," 94.4MHz",B'00101110',B'00011000'
	DT      "        "," 94.5MHz",B'00101110',B'01011000'
	DT      "        "," 94.6MHz",B'00101110',B'10011000'
	DT      "        "," 94.7MHz",B'00101110',B'11011000'
	DT      "        "," 94.8MHz",B'00101111',B'00011000'
	DT      "        "," 94.9MHz",B'00101111',B'01011000'
	DT      "        "," 95.0MHz",B'00101111',B'10011000'
	DT      "        "," 95.1MHz",B'00101111',B'11011000'
	DT      "        "," 95.2MHz",B'00110000',B'00011000'
	DT      "        "," 95.3MHz",B'00110000',B'01011000'
	DT      "        "," 95.4MHz",B'00110000',B'10011000'
	DT      "        "," 95.5MHz",B'00110000',B'11011000'
	DT      "        "," 95.6MHz",B'00110001',B'00011000'
	DT      "        "," 95.7MHz",B'00110001',B'01011000'
	DT      "        "," 95.8MHz",B'00110001',B'10011000'
	DT      "        "," 95.9MHz",B'00110001',B'11011000'
	DT      "        "," 96.0MHz",B'00110010',B'00011000'
	DT      "        "," 96.1MHz",B'00110010',B'01011000'
	DT      "        "," 96.2MHz",B'00110010',B'10011000'
	DT      "        "," 96.3MHz",B'00110010',B'11011000'
	DT      "        "," 96.4MHz",B'00110011',B'00011000'
	DT      "        "," 96.5MHz",B'00110011',B'01011000'
	DT      "        "," 96.6MHz",B'00110011',B'10011000'
	DT      "        "," 96.7MHz",B'00110011',B'11011000'
	DT      "        "," 96.8MHz",B'00110100',B'00011000'
	DT      "        "," 96.9MHz",B'00110100',B'01011000'
	DT      "        "," 97.0MHz",B'00110100',B'10011000'
	DT      "        "," 97.1MHz",B'00110100',B'11011000'
	DT      "        "," 97.2MHz",B'00110101',B'00011000'
	DT      "        "," 97.3MHz",B'00110101',B'01011000'
	DT      "        "," 97.4MHz",B'00110101',B'10011000'
	DT      "        "," 97.5MHz",B'00110101',B'11011000'
	DT      "        "," 97.6MHz",B'00110110',B'00011000'
	DT      "        "," 97.7MHz",B'00110110',B'01011000'
	DT      "        "," 97.8MHz",B'00110110',B'10011000'
	DT      "        "," 97.9MHz",B'00110110',B'11011000'
	DT      "        "," 98.0MHz",B'00110111',B'00011000'
	DT      "        "," 98.1MHz",B'00110111',B'01011000'
	DT      "        "," 98.2MHz",B'00110111',B'10011000'
	DT      "        "," 98.3MHz",B'00110111',B'11011000'
	DT      "        "," 98.4MHz",B'00111000',B'00011000'
	DT      "        "," 98.5MHz",B'00111000',B'01011000'
	DT      "        "," 98.6MHz",B'00111000',B'10011000'
	DT      "        "," 98.7MHz",B'00111000',B'11011000'
	DT      "        "," 98.8MHz",B'00111001',B'00011000'
	DT      "        "," 98.9MHz",B'00111001',B'01011000'
	DT      "        "," 99.0MHz",B'00111001',B'10011000'
	DT      "        "," 99.1MHz",B'00111001',B'11011000'
	DT      "        "," 99.2MHz",B'00111010',B'00011000'
	DT      "        "," 99.3MHz",B'00111010',B'01011000'
	DT      "        "," 99.4MHz",B'00111010',B'10011000'
	DT      "        "," 99.5MHz",B'00111010',B'11011000'
	DT      "        "," 99.6MHz",B'00111011',B'00011000'
	DT      "        "," 99.7MHz",B'00111011',B'01011000'
	DT      "        "," 99.8MHz",B'00111011',B'10011000'
	DT      "        "," 99.9MHz",B'00111011',B'11011000'
	DT      "        ","100.0MHz",B'00111100',B'00011000'
	DT      "        ","100.1MHz",B'00111100',B'01011000'
	DT      "        ","100.2MHz",B'00111100',B'10011000'
	DT      "        ","100.3MHz",B'00111100',B'11011000'
	DT      "        ","100.4MHz",B'00111101',B'00011000'
	DT      "        ","100.5MHz",B'00111101',B'01011000'
	DT      "        ","100.6MHz",B'00111101',B'10011000'
	DT      "        ","100.7MHz",B'00111101',B'11011000'
	DT      "        ","100.8MHz",B'00111110',B'00011000'
	DT      "        ","100.9MHz",B'00111110',B'01011000'
	DT      "        ","101.0MHz",B'00111110',B'10011000'
	DT      "        ","101.1MHz",B'00111110',B'11011000'
	DT      "        ","101.2MHz",B'00111111',B'00011000'
	DT      "        ","101.3MHz",B'00111111',B'01011000'
	DT      "        ","101.4MHz",B'00111111',B'10011000'
	DT      "        ","101.5MHz",B'00111111',B'11011000'
	DT      "        ","101.6MHz",B'01000000',B'00011000'
	DT      "        ","101.7MHz",B'01000000',B'01011000'
	DT      "        ","101.8MHz",B'01000000',B'10011000'
	DT      "        ","101.9MHz",B'01000000',B'11011000'
	DT      "        ","102.0MHz",B'01000001',B'00011000'
	DT      "        ","102.1MHz",B'01000001',B'01011000'
	DT      "        ","102.2MHz",B'01000001',B'10011000'
	DT      "        ","102.3MHz",B'01000001',B'11011000'
	DT      "        ","102.4MHz",B'01000010',B'00011000'
	DT      "        ","102.5MHz",B'01000010',B'01011000'
	DT      "        ","102.6MHz",B'01000010',B'10011000'
	DT      "        ","102.7MHz",B'01000010',B'11011000'
	DT      "        ","102.8MHz",B'01000011',B'00011000'
	DT      "        ","102.9MHz",B'01000011',B'01011000'
	DT      "        ","103.0MHz",B'01000011',B'10011000'
	DT      "        ","103.1MHz",B'01000011',B'11011000'
	DT      "        ","103.2MHz",B'01000100',B'00011000'
	DT      "        ","103.3MHz",B'01000100',B'01011000'
	DT      "        ","103.4MHz",B'01000100',B'10011000'
	DT      "        ","103.5MHz",B'01000100',B'11011000'
	DT      "        ","103.6MHz",B'01000101',B'00011000'
	DT      "        ","103.7MHz",B'01000101',B'01011000'
	DT      "        ","103.8MHz",B'01000101',B'10011000'
	DT      "        ","103.9MHz",B'01000101',B'11011000'
	DT      "        ","104.0MHz",B'01000110',B'00011000'
	DT      "        ","104.1MHz",B'01000110',B'01011000'
	DT      "        ","104.2MHz",B'01000110',B'10011000'
	DT      "        ","104.3MHz",B'01000110',B'11011000'
	DT      "        ","104.4MHz",B'01000111',B'00011000'
	DT      "        ","104.5MHz",B'01000111',B'01011000'
	DT      "        ","104.6MHz",B'01000111',B'10011000'
	DT      "        ","104.7MHz",B'01000111',B'11011000'
	DT      "        ","104.8MHz",B'01001000',B'00011000'
	DT      "        ","104.9MHz",B'01001000',B'01011000'
	DT      "        ","105.0MHz",B'01001000',B'10011000'
	DT      "        ","105.1MHz",B'01001000',B'11011000'
	DT      "        ","105.2MHz",B'01001001',B'00011000'
	DT      "        ","105.3MHz",B'01001001',B'01011000'
	DT      "        ","105.4MHz",B'01001001',B'10011000'
	DT      "        ","105.5MHz",B'01001001',B'11011000'
	DT      "        ","105.6MHz",B'01001010',B'00011000'
	DT      "        ","105.7MHz",B'01001010',B'01011000'
	DT      "        ","105.8MHz",B'01001010',B'10011000'
	DT      "        ","105.9MHz",B'01001010',B'11011000'
	DT      "        ","106.0MHz",B'01001011',B'00011000'
	DT      "        ","106.1MHz",B'01001011',B'01011000'
	DT      "        ","106.2MHz",B'01001011',B'10011000'
	DT      "        ","106.3MHz",B'01001011',B'11011000'
	DT      "        ","106.4MHz",B'01001100',B'00011000'
	DT      "        ","106.5MHz",B'01001100',B'01011000'
	DT      "        ","106.6MHz",B'01001100',B'10011000'
	DT      "        ","106.7MHz",B'01001100',B'11011000'
	DT      "        ","106.8MHz",B'01001101',B'00011000'
	DT      "        ","106.9MHz",B'01001101',B'01011000'
	DT      "        ","107.0MHz",B'01001101',B'10011000'
	DT      "        ","107.1MHz",B'01001101',B'11011000'
	DT      "        ","107.2MHz",B'01001110',B'00011000'
	DT      "        ","107.3MHz",B'01001110',B'01011000'
	DT      "        ","107.4MHz",B'01001110',B'10011000'
	DT      "        ","107.5MHz",B'01001110',B'11011000'
	DT      "        ","107.6MHz",B'01001111',B'00011000'
	DT      "        ","107.7MHz",B'01001111',B'01011000'
	DT      "        ","107.8MHz",B'01001111',B'10011000'
	DT      "        ","107.9MHz",B'01001111',B'11011000'
	DT      "        ","108.0MHz",B'01010000',B'00011000'

もうひとつ、電池残量を確認するために電圧を表示する機能を組み込みました。電源投入後のバージョン表示のあとに0.5秒だけ表示されます。下記の写真ではニッケル水素電池2本直列で使っていますが2.62Vになっています。ニッケル水素などの充電池は乾電池と違い、空になる直前に電圧が下がるのであまり残量表示にはならないかも知れませんが、多少の目安にはなるかと思っています。


もう少し確認して、プリント基板版ができたらソースを公開するつもりです。現在、電源オン時にたまに液晶が黒く(コントラストが強く)表示される現象が起きていて、その原因を調査したく思っています。電圧測定が正しくできなかったのか、LCDへのコントラストコマンド送出がよくないのか。黒く表示されたときに電源を入れ直すと解決し、その後しばらくは何度か入れ直しても大丈夫。AD変換のクロックが適切でなかったので修正したのですが、解決していません。単純に電源投入から少し時間をおいて電圧が安定してから測定すればよいのかも。

注文したプリント基板のステータスをみるとまだ発送されていません。以前より少し時間がかかっているようです。タイミングにもよるのかも知れませんが。

0 件のコメント:

コメントを投稿