新聞中心

EEPW首頁(yè) > 測(cè)試測(cè)量 > 設(shè)計(jì)應(yīng)用 > 示波器遠(yuǎn)程控制方法在瑞薩集成開(kāi)發(fā)環(huán)境CubeSuite+中的應(yīng)用

示波器遠(yuǎn)程控制方法在瑞薩集成開(kāi)發(fā)環(huán)境CubeSuite+中的應(yīng)用

作者:張娜 王志東 許柯萍 時(shí)間:2014-10-28 來(lái)源:電子產(chǎn)品世界 收藏
編者按:  摘要:在瑞薩單片機(jī)集成開(kāi)發(fā)環(huán)境CubeSuite+下,使用IronPython語(yǔ)言在Python Console平臺(tái)中控制橫河DL9000系列示波器的參數(shù)設(shè)置,并接收測(cè)試波形,從而簡(jiǎn)化單片機(jī)功能驗(yàn)證操作,為單片機(jī)功能驗(yàn)證的自動(dòng)化實(shí)施提供了保證。   前言   在單片機(jī)功能驗(yàn)證過(guò)程中,需要利用示波器采集驗(yàn)證結(jié)果的波形,而示波器參數(shù)的設(shè)置一般是通過(guò)手動(dòng)設(shè)置前端面板按鍵完成。功能驗(yàn)證的結(jié)果需要手動(dòng)保存到U盤中,由工程師再拷貝到電腦上。圖1為橫河DL9000系列示波器的前面板示意圖,從圖中可以看出,示波器

  #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()

本文引用地址:http://m.butianyuan.cn/article/264533.htm

  3 結(jié)論

  的遠(yuǎn)程自動(dòng)配置和波形文件的上傳處理,簡(jiǎn)化了操作和波形文件整理,降低因操作和整理波形產(chǎn)生的勞動(dòng)負(fù)荷,有助于逐步實(shí)現(xiàn)功能驗(yàn)證自動(dòng)化。

  參考文獻(xiàn):
  [1]Renesas IDE [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


上一頁(yè) 1 2 3 下一頁(yè)

評(píng)論


相關(guān)推薦

技術(shù)專區(qū)

關(guān)閉