AR-3000Aの自動メモリ入力ツール
<1.概要>
バンク毎に、CSVファイルに記憶した周波数データを、Tera Termのマクロ機能を使って、自動でAR-3000Aに転送するツールです。
<2.CSVファイル準備>
図2-1の構成で、CSVファイルを作成します。
図2-1 CSVファイル構成
 CSVファイルの各列の意味を表2-1に示します。
表2-1 各列の説明
CSVファイルのセルは“文字列”の設定にしてください。
シートの左上(行と列の交わるところ)で右クリックして、“セルの書式設定”を選択します(図2-2)。
図2-2 セルの書式設定選択
そして、“表示形式”- “分類” で、“文字列”を選択して、OKボタンを押します。(図2-3)
図2-3 “文字列”選択 
その上で、各列のデータを設定して、CSVファイルとして保存します。
<3.パソコンとAR-3000Aとの接続>
パソコンとAR-3000とはシリアル(COM)で接続します。
パソコン側はDsub 9Pinメス、AR-3000側はDsub25Pinオスのストレートケーブルで接続します。(図3-1)
図3-1 Dsub9Pinメス - Dsub25Pinオス ストレートケーブル
<4.Tera Termの起動とAR-3000との通信確認>
Tera Termを起動します。(図4-1)
図4-1 Tera Termの起動
起動したら、パソコンのCOM設定を行います。(図4-2、4-3)
図4-2 シリアルポート設定選択
図4-3 シリアルポート設定内容
図4-3で、“ポート”は使用しているCOMポートの番号を入れてください。
ボー・レートは、AR-3000の設定によって、“4800”か“9600”を設定します。
データは“8bit”、パリティは“none”、ストップは“2bit”を設定してください。
この設定の後、AR-3000の背面にある、スライドSWをON(REMOTE)にします。(図3-4)
図4-4 AR-3000の背面SW
接続に問題が無ければ、AR-3000からオープンメッセージが送信されます。(図3-5)
図4-5 オープンメッセージ
 <5.マクロ起動とデータ転送>
CSVデータをAR-3000に転送するマクロを呼び出します。(図5-1,5-2)
図5-1 マクロ呼び出し
図5-2 マクロファイル選択
そうすると、ファイル選択窓が開くので、転送データのCSVファイルを選択します。(図5-3)
図5-3 CSVファイル選択
AR-3000への転送が始まると、パソコンからの転送結果が、Tera Termの画面に表示されます。正常終了すると、“正常終了”と表示が出ます。異常終了した場合は“異常終了”と表示されます。(図5-4)
図5-4 転送中、転送終了画面
これで、AR-3000へのデータ転送は完了です。
転送が終了したら、AR-3000の裏面のスライドSWをOFFにすれば、AR-3000のパネルから操作が出来るようになります。
------------------------------------------------------------------------------
マクロファイル、CSVファイルはこちらにアップしてあります。
https://docs.google.com/open?id=0B_-iH9ny-AE-NlU1WW5IY2F6LWs 
このファイルがダウンロードできない場合は、下記のソースコードをコピーしてください。
-------------------------------------------------------------------------------
<マクロソースコード>
以下のコードを拡張子”TTL”のファイルとして保存して、Tera Termから呼び出ししてください
-------------------------------------------------------------------------------
 filenamebox 'Memory File selection' 0
if result<>0 then
    ; file name 取得完了
    ;DBG messagebox inputstr 'file name'
    
    getdir motodir
    dirname dir inputstr
    setdir dir
    ;DBG messagebox dir ''
    basename fname inputstr
    ;DBG messagebox fname ''
    fileopen fhandle inputstr 0
    
    ;DBG messagebox fhandle 'file handle'
    if fhandle <>-1 then
        ; file open 成功
        chData = '0'
        :loop
            filereadln fhandle line
            ;DBG messagebox line inputstr
            if result goto readEnd
            strsplit line ',' 9
            
            ; comment
            strscan groupmatchstr1 ';'
            if result = 0 then
                ; bank No
                strcompare groupmatchstr2 chData
                if result <> 0 then 
                    chData = groupmatchstr2
                    send chData
                    send 'X'
                    ;CR
                    send #13
                    ;LF
                    send #10
                    
                    ;応答('>')待ち
                    timeout = 1
                    wait '>'
                    if result = 0 goto errorEnd
                endif
                
                sendData = ''
                
                ; ch No
                strcompare groupmatchstr3 ''
                if result = 0 goto loop
                strconcat sendData groupmatchstr3
                strconcat sendData 'M'
                
                ; step
                strcompare groupmatchstr4 ''
                if result <> 0 then
                strconcat sendData groupmatchstr4
                strconcat sendData 'S'
                endif
                
                ; ATT
                strcompare groupmatchstr5 ''
                if result <> 0 then
                strconcat sendData groupmatchstr5
                endif
                
                ; frequncy
                strcompare groupmatchstr6 ''
                if result = 0 goto loop
                strconcat sendData groupmatchstr6
                
                ; mode
                strcompare groupmatchstr7 ''
                if result = 0 goto loop
                strconcat sendData groupmatchstr7
                
                send sendData
                send 13        ;CR
                send 10        ;LF
                ;応答('>')待ち
                timeout = 1
                wait '>'
                if result = 0 goto errorEnd
                
                ;アンサーバック
                send groupmatchstr3
                send 'Z'
                send 13        ;CR
                send 10        ;LF
                ;応答('>')待ち
                timeout = 10
                wait '>'
                if result = 0 goto errorEnd
                
            endif
            goto loop
        :readEnd
        dispstr '正常終了'
        goto end
        
        :errorEnd
        dispstr '異常終了
        goto end
        
        :end
        fileclose fhandle
    endif
    
endif
--------------------------------------------------------------------------------
以上