Controlling measurement instruments via GPIB 通过GPIB控制仪器.docx
- 文档编号:29248247
- 上传时间:2023-07-21
- 格式:DOCX
- 页数:22
- 大小:390.51KB
Controlling measurement instruments via GPIB 通过GPIB控制仪器.docx
《Controlling measurement instruments via GPIB 通过GPIB控制仪器.docx》由会员分享,可在线阅读,更多相关《Controlling measurement instruments via GPIB 通过GPIB控制仪器.docx(22页珍藏版)》请在冰豆网上搜索。
ControllingmeasurementinstrumentsviaGPIB通过GPIB控制仪器
ControllingmeasurementinstrumentsviaGPIB
IntroductiontoGPIB
GPIB(GeneralPurposeInterfaceBus)isaninterfacestandardforconnectingcomputersandperipherals,whichsupportsthefollowinginternationalstandards:
IEEE488.1,IEC-625,IEEE488.2,andJIS-C1901.TheGPIBinterfaceallowsyoutocontrolvariousinstrumentsfromanexternalcomputer.ThecomputersendscommandsandinstructionstotheinstrumentsandreceivesdatasentfromtheinstrumentsviaGPIB.
Beforesettinguptheinstrumentforremotecommunicationsusingtheelectronic(physical)GPIBinterface,youshouldfamiliarizeyourselfwiththefollowingGPIBrequirements:
▪Auniquedeviceaddressmustbeassignedtoeachdeviceonthebus.
▪Notwodevicescansharethesamedeviceaddress.
▪Nomorethan15devicescanbeconnectedtoanyoneline.
▪Onedeviceshouldbeconnectedforevery6feet(2meters)ofcableused.
▪Nomorethan65feet(20meters)ofcableshouldbeusedtoconnectdevicestoabus.
▪Atleasttwo-thirdsofthedevicesonthenetworkshouldbepoweredonwhileusingthenetwork.
▪Connectthedevicesonthenetworkinastarorlinearconfiguration.Donotuselooporparallelconfigurations.
ThefollowingfigureillustratesatypicalGPIBinterfacesystem.
Figure1:
atypicalGPIBinterfacesystem
Ifnecessary,theGPIBconnectorscanbestackedasshowninthefollowingfigure:
Figure2:
stackofGPIBconnectors
IntroductiontoSCPI
SCPI(StandardCommandsforProgrammableInstruments)isaprogramminglanguageforcontrollinginstrumentfunctionsovertheGPIB(GeneralPurposeInterfaceBus,IEEE488)instrumentbus.SCPIisintendedtofunctionwithstandardGPIBhardwareandconformstotheIEEEStandardDigitalInterfaceforProgrammableInstrumentation.SCPIislayeredontopofthehardwareportionofIEEE488.2.
ThesameSCPIcommandsandparameterscontrolthesamefunctionsindifferentclassesofinstruments.Foreachinstrumentfunction,SCPIdefinesaspecificcommandset.TheadvantageofSCPIisthatprogramminganinstrumentisonlyfunctiondependentandnolongerinstrumentdependent.Severaldifferenttypesofinstruments,forexampleanoscilloscope,acounterandamultimeter,cancarryoutthesamefunction,suchasfrequencymeasurement.IftheseinstrumentsareSCPIcompatible,youcanusethesamecommandstomeasurethefrequencyonallthreeinstruments,althoughtheremaybedifferencesinaccuracy,resolution,speed,etc.
FunctionalityofaSCPIinstrument
ThefunctionsinsideaninstrumentthatcontroltheoperationprovideSCPIcompatibility.
Figure3showsasimplifiedlogicalmodelofthemessageflowinsideaSCPIinstrument.
WhenthecontrollersendsamessagetoaSCPIinstrument,roughlythefollowinghappens:
–TheGPIBcontrolleraddressestheinstrumentaslistener.
–TheGPIBinterfacefunctionplacesthemessageintheInputBuffer.
–TheParserfetchesthemessagefromtheInputBuffer,parses(decodes)themessage,andchecksforthecorrectsyntax.Theinstrumentreportsincorrectsyntaxbysendingcommanderrorsviathestatussystemtothecontroller.Moreover,theparserwilldetectifthecontrollerrequiresaresponse.Thisisthecasewhentheinputmessageisaquery(commandwitha“?
”appended).
TheParserwilltransfertheexecutablemessagestotheExecutionControlblockintokenform(internalcodes).TheExecutionControlblockwillgathertheinformationrequiredforadeviceactionandwillinitiatetherequestedtaskattheappropriatetime.TheinstrumentreportsexecutionerrorsviathestatussystemovertheGPIBandplacesthemintheErrorQueue.
–Whenthecontrolleraddressestheinstrumentastalker,theinstrumenttakesdatafromtheOutputQueueandsendsitovertheGPIBtothecontroller.
SCPIcommandsaresentasASCIIoutputstringswithintheprogramminglanguagestatements,theSCPIsyntaxisindependentofbothprogramminglanguageandinterface.
Figure3:
OverviewofthefirmwareinaSCPIinstrument
TypesofSCPICommands
SCPIhastwotypesofcommands,commonandsubsystem.
CommonCommands
Commoncommandsgenerallyarenotrelatedtospecificoperationbuttocontrollingoverallinstrumentfunctions,suchasreset,status,andsynchronization.Allcommoncommandsconsistofathree-lettermnemonicprecededbyanasterisk:
*RST*IDN?
*SRE8
Figure4:
CommonCommandsSyntaxDiagram
*Fordetails,referto“Agilent_DSA90604A_Infiniiumoscilloscope_programmingguide.pdf”,page26-33
SubsystemCommands
Subsystemcommandsperformspecificinstrumentfunctions.
SCPIisanASCII-basedinstrumentcommandlanguagedesignedfortestandmeasurementinstruments.SCPIcommandsarebasedonahierarchicalstructure,alsoknownasatreesystem.Inthissystem,associatedcommandsaregroupedtogetherunderacommonnodeorroot,thusformingsubsystems.Subsystemcommandsperformspecificpowersupplyfunctions.AportionoftheSOURcesubsystemisshownbelowtoillustratethetreesystem.
SOURceistherootkeywordofthecommand,CURRentisasecond-levelkeyword,LEVelandPROTectionarethird-levelkeywords,andIMMediate,TRIGgeredandSTATearefourth-levelkeywords.Colons(:
)separatehigher-levelfromlower-levelkeywords.
Figure5isatreediagramofthesubsystemcommandsforDCpowersupply6674A.Commandsfollowedbyaquestionmark(?
)takeonlythequeryform.Exceptasnotedinthesyntaxdescriptions,allothercommandstakeboththecommandandqueryform.Thecommandsarelistedinalphabeticalorderandthecommandswithineachsubsystemaregroupedalphabeticallyunderthesubsystem.
Figure5:
SubsystemCommandsTreeDiagram
StructureofaSCPIMessage
SCPImessagesconsistofoneormoremessageunitsendinginamessageterminator.Theterminatorisnotpartofthesyntax,butimplicitinthewayyourprogramminglanguageindicatestheendofaline(suchasanewlineorend-of-linecharacter).
TheMessageUnit
ThesimplestSCPIcommandisasinglemessageunitconsistingofacommandheader(orkeyword)followedbyamessageterminator.
ABOR
VOLT?
Themessageunitmayincludeaparameteraftertheheader.Theparameterusuallyisnumeric,butitcanbeastring:
VOLT20
VOLTMAX
CombiningMessageUnits
Thefollowingcommandmessage(seeFigure6)isbrieflydescribedhere,withmoredetailsinsubsequentparagraphs.
VOLT:
LEV4.5;PROT4.8;:
CURR?
Figure6:
CommandMessageStructure
ThebasicpartsofthemessageinFigure6are:
MessageComponentExample
HeadersVOLTLEVPROTCURR
HeaderSeparatorThecoloninVOLT:
LEV
Data4.54.8
DataSeparatorThespaceinVOLT4.5andPROT4.8
MessageUnitsVOLT:
LEV4.5PROT4.8CURR?
MessageUnitSeparatorThesemicolonsinVOLT:
LEV4.5;andPROT4.8;
RootSpecifierThecoloninPROT4.8;:
CURR?
QueryIndicatorThequestionmarkinCURR?
MessageTerminatorThe
partoftheSCPIsyntax.
GPIBsettingandSCPIcommandsforinstruments
GPIBAddressSettingforinstruments
FortheGPIBinterface,messagesareplacedonthebususinganoutputcommandandpassingthedeviceaddress,programmessage,andaterminator.PassingthedeviceaddressensuresthattheprogrammessageissenttothecorrectGPIBinterfaceandGPIBdevice.
ProcessforsettingGPIBaddressforinstrumentsis:
Oscilloscope
−TectronixDSA73304D
oThedefaultsettingsfortheGPIBconfigurationare:
GPIBAddress1.
oTochangeeitheroftheGPIBsettings,dothefollowing:
SelectGPIBConfigurationfromtheUtilitiesmenuonfrontpanel.
−AgilentDSA90604A
oDeviceAddress=(InterfaceSelectCode*100)+OscilloscopeAddress
oEachinterfacecardhasauniqueinterfaceselectcode.Thiscodeisusedbythecomputertodirectcommandsandcommunicationstotheproperinterface.Thedefaultistypically"7"fortheGPIBinterfacecards
oEachoscilloscopeontheGPIBmusthaveauniqueoscilloscopeaddressbetweendecimal0and30.Thisoscilloscopeaddressisusedbythecomputertodirectcommandsandcommunicationstotheproperoscilloscopeonaninterface.Thedefaultistypically"7"forthisoscilloscope.YoucanchangetheoscilloscopeaddressintheUtilities,RemoteInterfacedialogbox.
oDoNotUseAddress21foranOscilloscopeAddress,Address21isusuallyreservedfortheComputerinterfaceTalk/Listenaddress,andshouldnotbeusedasanoscilloscopeaddress.
Signalsourceanalyzer
−AgilentE5052B
oPressSystem>MiscSetup>GPIBSetup>Talker/ListenerAddress.
oEntertheaddressusingtheENTRYblockkeysonthefrontpanel.
DCpowersupply
−AgilentN5745A
oThepowersupplyisshippedwithitsGPIBaddresssetto5.UsethefrontpanelmenuifyouneedtochangetheGPIBaddress.
aPressandholdtheOCP/488buttonforaboutthreeseconds.TheDCVOLTSdisplaywillshowthepresentGPIBaddress.
bTochangetheGPIBaddress,turnthevoltageknobuntilthedesiredGPIBaddressappearsinthedisplay.ValidGPIBaddressesareintherangeof0to30.
−HPAgilent6674A(HPIB)
oThepowersupplyaddresscannotbesetremotely;itmustbesetfromthefrontpanel.Oncetheaddressisset,youcanassignitinsideprograms.
oUsetheADDRESSkeyandnumericalkeypadforenteringaddresses.Thepowersupplyisshippedwitha5stand-aloneaddressasthedefault.Thegeneralprocedureforsettinganaddressis:
Frequencycalibrator/analyzer
−PendulumCNT-91R
oTheaddressofthecounterissetto10whenitisdelivered
oSetGPIBAddressviathefrontpanelUSEROPTmenu
onumberbetween0and30
Warmbox
−VotschWEISSTECHNIKC7-600
oNOTAVEAIIBLE!
!
oUseGPIB-RS232converter(forexampleFT7130GPIB-RS232)
SCPICommandsforinstruments
Osc
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Controlling measurement instruments via GPIB 通过GPIB控制仪器 通过 控制 仪器
![提示](https://static.bdocx.com/images/bang_tan.gif)
链接地址:https://www.bdocx.com/doc/29248247.html