示波器遠程控制方法在瑞薩集成開發(fā)環(huán)境CubeSuite+中的應(yīng)用
#Add Class
import clr
clr.AddReferenceToFile("TmctlAPINet.dll")
from TmctlAPINet import *
#New Object
h=TMCTL()
ykosid =0
#Initializes and opens a connection to the specified devices:DL9040 serial number=91FC36537
ret=h.Initialize(h.TM_CTL_USBTMC,"91FC36537", ykosid)
#Sets the terminator for sending or receiving a message to LF
ret=h.SetTerm(ykosid,2,1)
#sets the timeout time for communications.
ret=h.SetTimeout(ykosid,100)
#Sets remote on
ret=h.Send(ykosid, "COMMUNICATE:REMOTE ON")
#Sets the display format
ret=h.Send(ykosid,"DISPLAY:FORMAT QUAD")
#Sets the graticule
ret=h.Send(ykosid, "DISPLAY:GRATICULE GRID")
#Turns on the cursor
ret=h.Send(ykosid,"CURSOR:DISPLAY 1")
#Turns on the display of the channel
ret=h.Send(ykosid," CHANNEL1: DISPLAY ON")
#Sets the vertical position of the channel
ret=h.Send(ykosid," CHANNEL4: POSITION -2")
#Turns ON the waveform label display of the channel
ret=h.Send(ykosid,"CHANNEL4:LABEL:MODE 1")
#Sets the waveform label of channel
ret=h.Send(ykosid,"CHANNEL4:LABEL:DEFINE 'TRDIOD0'")
#Sets the vertical sensitivity (V/div) of the channel
ret=h.Send(ykosid,"CHANNEL4:VDIV 2")
#Sets the T/div value
ret=h.Send(ykosid,"TIMEBASE:TDIV 1.000E-03")
#Sets the file output image format
ret=yktmc.Send(ykosid," HCOPY:FILE:FORMAT PNG")
# Queries the screen image data
ret=yktmc.Send(ykosid," IMAGe:SEND?")
# Receives the header portion of the Block Data sent from the device, and
# returns the number of bytes of the data after the header.
ret,c=yktmc.ReceiveBlockHeader(ykosid, 0)
temp=0
ImageName1='d:/'+ImageName+'.png'
output = open(ImageName1,'wb')
for i in range(c+1) :
# Receives the data portion of the Block Data sent from a device into an Short array.
ret,temp,rlen,rend=yktmc.ReceiveBlockData(ykosid,temp,1,0,0)
output.write(chr(temp))
output.close()
3 結(jié)論
示波器的遠程自動配置和波形文件的上傳處理,簡化了示波器操作和波形文件整理,降低因操作示波器和整理波形產(chǎn)生的勞動負(fù)荷,有助于逐步實現(xiàn)單片機功能驗證自動化。
參考文獻:
[1]Renesas IDE CubeSuite+[R/OL].http://cn.renesas.com/products/tools/ide/ide_cubesuite_plus/index.jsp
[2]IronPython in Action, Michael J. Foord, Christian Muirhead, Manning Publications Co.,2009
[3]Yokogawa Releases New DL9000 Series of Compact Digital Oscilloscopes with GHz Bandwidth[R/OL].(2005-4-1).http://www.yokogawa.com/pr/Corporate/News/2005/pr-news-2005-09-en.htm
[4]DL9040/DL9140/DL9240 Series Digital Oscilloscope User’s Manua.2009
[5]DL9040/DL9140/DL9240 Series Digital Oscilloscope Communication Interface User’s Manual.Yokogawa Electric Corporation,2009
評論