compass GPIB通信チェック{ モード プログラム 表示位置 中央 記録フォーム表示 右下 サイズ設定 650, 550 } 変数 $address = 1 #GPIBアドレス 変数 $command = "*IDN?" #コマンド文字列 変数 $delimiter = "(CRLF)" #デリミタ文字列 変数 $cmd = "" #送信文字列 変数 $wait = 100 #送信-受信の待ち時間 変数 $result #受信文字列 変数 $before = "(CRLF)" #置換する文字列 変数 $after = " " #置換後の文字列 exe アドレスの入力{ 入力 ($address) } exe 送信文字列の入力{ 入力 ($command) } exe デリミタの入力{ メッセージ "Carriage ReturnとLine Feedは次のように記入します:(CR), (LF), (CRLF)" 入力 ($delimiter) } exe 置換する受信文字列の入力{ 入力 ($before) } exe GPIBアドレスのチェック方法{ メッセージ "Measurement and Automation Explorerを起動し、デバイスとインターフェース欄のボード選択後、「機器のスキャン」を行う" } exe exe 送信テスト{ 結合 ($cmd) = $command & $delimiter GPIB.開始 $address GPIB.送信 $address, $cmd GPIB.終了 $address 結合 ($result) = $address & " : " & $cmd 記録 $result } exe 送受信テスト{ 結合 ($cmd) = $command & $delimiter GPIB.開始 $address GPIB.送信 $address, $cmd 待機 $wait GPIB.受信 ($result), $address GPIB.終了 $address 置換 ($result), $before, $after 結合 ($result) = $address & " : " & $cmd & " : " & $result 記録 $result } exe 受信テスト{ GPIB.開始 $address GPIB.受信 ($result), $address 置換 ($result), $before, $after 結合 ($result) = $address & " : " & $result 記録 $result GPIB.終了 $address } exe exe 送信の繰り返し{ GPIB.開始 $address ■繰り返し 送信, 1000, 100 GPIB.終了 $address } sub 送信{ 結合 ($cmd) = $command & $delimiter GPIB.送信 $address, $cmd 結合 ($result) = $address & " : " & $cmd 記録 $result } exe 受信の繰り返し{ GPIB.開始 $address ■繰り返し 受信, 1000, 100 GPIB.終了 $address } sub 受信{ GPIB.受信 ($result), $address 置換 ($result), $before, $after 結合 ($result) = $address & " : " & $result 記録 $result } exe 送受信の繰り返し{ GPIB.開始 $address ■繰り返し 送受信, 1000, 100 GPIB.終了 $address } sub 送受信{ 結合 ($cmd) = $command & $delimiter GPIB.送信 $address, $cmd 待機 $wait GPIB.受信 ($result), $address 置換 ($result), $before, $after 結合 ($result) = $address & " : " & $cmd & " : " & $result 記録 $result } exe exe コマンドを変えながら送信の繰り返し{ 計算 $n = 0 GPIB.開始 $address ■繰り返し 次の送信, 1000, 100 GPIB.終了 $address } sub 次の送信{ 計算 $n = $n + 10 結合 ($command) = "test" & $n 結合 ($cmd) = $command & $delimiter GPIB.送信 $address, $cmd 結合 ($result) = $address & " : " & $cmd 記録 $result } exe コマンドを変えながら送受信の繰り返し{ 計算 $n = 0 GPIB.開始 $address ■繰り返し 次の送受信, 1000, 100 GPIB.終了 $address } sub 次の送受信{ 計算 $n = $n + 10 結合 ($command) = "test" & $n 結合 ($cmd) = $command & $delimiter GPIB.送信 $address, $cmd 待機 $wait GPIB.受信 ($result), $address 置換 ($result), $before, $after 結合 ($result) = $address & " : " & $cmd & " : " & $result 記録 $result }