Using LabVIEW with the General Purpose Interface Bus GPIB,
(The IEEE !! Bus" # $ata %c&uisition Lab Pro'ect (o))unicating between Progra))able Electronic Instru)ents an* the P( LabVIEW: Virtual Instrument Environmental Workstation- is an icon software program of National Instruments VI or vi: virtual instrument Notes by: Oren Zarcin! "vraam #emenkee! an$ %alp & %acel %osenbaum! #cool of 'ysics an$ "stronomy! (el "viv )niversity! Electronic Lab - #enkar *+,! %amat "viv- .ebruary! /++/ %+ Initial Preparations ,- Install te 0'I1 car$ into your '2 moterboar$3 /- Install LabVIEW program into your ar$ $isk3 *- 2onnect up te 0'I1 2ables between your instruments an$ te 0'I1 car$3 inspect te cable plugs - are tey O45 6- 'rogram eac of your electronic instruments to respon$ to: a- 0'I1 or IEEE 677 bus an$ not te %# /*/ bus- b- 0ive an a$$ress number between , to // to eac of your instruments3 remember wic instrument as wic a$$ress number- "voi$ using te a$$resses of number + an$8or number 9! often use$ by te 0'I1 controller car$ in te moterboar$- c- On eac electronic instrument! coose te programming comman$ language - #2'I :#cientific 2omman$s for 'rogrammable Instruments;- $- 2onnect up a voltage source or resistor to your $igital multimeter to confirm tat it is respon$ing correctly to your front panel settings- /*<*,/*=,-$oc , Version! .eb- /++/ B+ ,tarting up -our P( ,- 'ower up your '2 /- (ype in te following info::vali$ as of .ebruary! /++/;: )ser>s Name: administrator 'ass Wor$: lab *- 2lick on te National Instrument LabVIEW Icon to get te following Win$ow: LabVIEW NO(E: .or an intro$uction to LabVIEW! rea$ te ?LabVIEW (utorial@- N"(ION"L IN#(%)AEN(# LabVIEW New VI :Virtual Instrument; Open VI B"C #olutions #earc EDamples LabVIEW (utorial EDit 6- 2lick on te ?New VI@ button to get te following new win$ow: Insi$e tis win$ow appears two screens - one is te ?.ront 'anel@ appearing in te ?0rey 2olor@ an$ te secon$ screen is te ?1lock Biagram@ appearing in te ?Wite 2olor@- <- 2lick on te ?Wite 2olor #creen@ or eEuivalently! te ?1lock Biagram@ to bring it forwar$ on te screen- (e ?.ront 'anel@ or ?0rey 2olor #creen@ will go bein$ te ?1lock Biagram@ an$ will be partially blocke$ off by it- /*<*,/*=,-$oc / Version! .eb- /++/ . % LabVIEW Progra) to (ontrol the /ewlett Pac0ar* $igital Multi)eter # the /P123a 45ront Panel6 4Bloc0 $iagra)6 /*<*,/*=,-$oc * Version! .eb- /++/ =- Now go to te ?.unction 1ar@ tat appears near te top of te screen: .ile E$it Operate (ools 1rowse Win$ow Felp 2lick on te ?Win$ow@ button to get te following $ialog boD: 2lick on te G#ow (ools 'aletteG an$ move tis 'alette to one si$e of te screen- We will use it all te time to e$it our programs #ow 'anel #ow .unctions 'alette #ow (ools 'alette #ow 2lipboar$ #ow Error List (ile Left an$ %igt (ile )p an$ $own .ull #iHe 9- 2lick on te ?#ow .unction 'alette@ button to get te following: Functions Palette (e .unctions palette is available only on te ?Bloc0 $iagra)6- (e .unctions palette contains te obIects you use to program your VI! suc as aritmetic! instrument I8O! file I8+! an$ $ata acEuisition operations- #elect Win*ow ,how 5unctions Palette or rigt- click te block $iagram workspace to $isplay te 5unctions palette- Jou can place te 5unctions palette anywere on te screen- 7- Now click on te <t Icon tat appears on te left-an$ si$e- /*<*,/*=,-$oc 6 Version! .eb- /++/ K- "fter clicking on te <t Icon! we get a new menu $ialog boD: ,+- Now click on te Inst8Lib Icon to get te ?Instrument Brivers ?programs tat National Instruments ave written for $ifferent electronic eEuipment :for eDample! 4eitley! Fewlett 'ackar$! (eDtronics! .luke! ect-;- "vraam as installe$ te ?$rivers@ tat we will use an$ nee$- If you are missing a particular $river for a particular instrument! ask "vraam to install it- 2oose te $river program for our Fewlett 'ackar$ Bigital Volt Aeter! -te F' *66+," BAA or $igital multimeter :te BAA;: ,,- Now click on te *66+," $river program icon to get te new following menu $ialog boD: p *66+,a InitialiHe-vi p *66+,a InitialiHe wit Options-vi "pplications 2onfiguration Aeasurement )tility :for $etecting errors; p *66+,a 2lose-vi /*<*,/*=,-$oc < Version! .eb- /++/ Instrument I8+ Inst8Lib Icon Fere appear oter Icons We will use tese tree Icons in te following eDample Instrument Briver *66+," Fere appear oter $rivers 'icture of te BAA ,/- 0o to te p *66+,a InitialiHe-vi button an$ $rag its Icon onto te left si$e of te ?1lock Biagram@3 you nee$ first to $ouble click on te left mouse button- Now go to te "pplication button to get te following $rop-$own (able: 0etting #tarte$-vi #ingle 'oint Aeasurement-vi Aulti 'oint Aeasurement-vi Figligt te Aulti 'oint Aeasurement-vi an$ $rag its Icon onto te mi$$le ofL te ?1lock Biagram@- Now coose te p*66+,a 2lose-vi button! igligt it an$ $rag its Icon onto te rigt an$ si$e of te ?1lock Biagram@- Jour 1lock Biagram soul$ ave * Icons on it an$ soul$ look like tis: ,*- We now ave to connect ?wires@ or electrical cables between tese tree Icons or Operational 1locks of te BAA- .irst! we nee$ te wire tool wic is calle$ ?2onnect Wire@ or ?#pool of Wire - %alpLs name@ wic you fin$ on te (ool 'alette: (ere are two $ifferent ?terminals@ on eac ofL te above tree Icons wic nee$ connecting - one terminal is calle$ te ?Instrument Fan$le@ terminal an$ te secon$ terminal:s; are labelle$ un$er te name ?Error Out@ or ?Error In@- In or$er to connect te ?Instrument Fan$le@ terminals to one anoter! take te ?2onnect Wire@ spool onto te rigt si$e of te ?InitialiHe@ Icon an$ various $ifferent terminals will be $isplaye$ as you move te ?2onnect Wire@ tool up an$ $own te rigt si$e of te Icon- .in$ te terminal labelle$ ?Instrument Fan$le@ terminal- Brag te spool to te secon$ Icon - te ?A)L(-'( AE"#@ Icon an$ fin$ on its left si$e te correspon$ing ?Instrument Fan$le@ terminal- 2lick on te mouse to Ioin tese two terminals togeter- )sing te same proce$ure! connect te ?Instrument Fan$le Out@ terminal on te rigt si$e of te ?A)L(-'( AE"#@ Icon to te ?Instrument Fan$le@ terminal on te tir$ an$ last Icon - te ?2lose@ Icon- /*<*,/*=,-$oc = Version! .eb- /++/ p*66+,a InitialiHe p*66+,a MULT7PT ME%, ME%, p*66+,a 2lose Bo te same proce$ure now to te ?Error@ terminals! connecting wires or cables between all te error terminals of te tree Icons- Jour block $iagram soul$ look someting like tis :see bottom part of page *;: ,6- We now ave to tell te LabVIEW 0'I1 program via te ?InitialiHe@ Icon wat bus we will use :0'I1 bus or F'I1 or te IEEE 677 bus! all eEuivalent3 but not te %#/*/ bus; an$ since we will use te 0'I1 bus! we must tell te program wat is te ?a$$ress@ of our BAA! wic we presumably set earlier to te a$$ress of ?,/@- a; (ake te ?2onnect Wire@ tool to te left si$e of te ?InitialiHe@ Icon an$ fin$ te Input terminal labelle$ by te name ?%esource Name@- b; #tan$ on tis terminal an$ click on te %I0F( 1utton of te Aouse! (e following ?$rop-$own@ table soul$ appear: Visible Items Felp Bescription an$ (ips---- #et 1reak 'oint Create 2onstant %eplace Control :use$ to input $ata on te ?.ront 'anel@; 8++++ In$icators :to $isplay output $ata on ?.ront 'anel@; Figligt te ?2reate@ button an$ you will get te secon$ ?$rop-$own@ table sown above on te rigt si$e3 coose te ?2ontrol@ button an$ ?2lick@ it- (e program soul$ now Iump back to te ?1lock Biagram@ an$ Iust above your first Icon - te ?InitialiHe Icon@ tere soul$ appear a ?little win$ow or table@ $isplaying: %esource Name :?0'I1::,6::IN#(%@;- c; We nee$ only to cange te a$$ress from te $efault a$$ress of ,6 to our cosen a$$ress of ,/- (o $o tis! go to te ?.ront 'anel@ by clicking on te ?0rey 2olor@ panel- (ere is a little win$ow tat appears wit te name ?%esource Name@- )sing te e$it tool ! cange te $etails of te boD to ?0'I1::,/::IN#(%@- Now click te ?O4@ button - Lastly! go back to te ?1lock Biagram@ by clicking on its ?Wite 2olor@ panel- 2orrect te label from ?0'I1::399IN#(%@ to ?0'I1::3:99IN#(%@- ,<- Now let>s program our BAA to make /+ sample rea$ings for eac trigger- (o $o tis! go to te mi$$le Icon! te ?A)L(-'( AE"#@ Icon an$ use te 2onnect Wire tool to scan te terminals on te bottom e$ge of tis Icon- .in$ te terminal labelle$ by te name /*<*,/*=,-$oc 9 Version! .eb- /++/ InitialiHe MULT7PT ME%, 2lose ?#ample 2ount :,;@- 2lick again on te %I0F( #i$e Aouse button to get te ?Brop Bown@ tables of step ,6; again- 2oose te ?2ontrol@ button an$ repeat te steps of step ,6; going to te ?.ront 'anel@ again an$ typing in te number ?/+@ instea$ of ?,@ tat appears in te little win$ow or $isplay labelle$ by ?#ample 2ount@- %eturn to te ?1lock Biagram@ again- ,=- .inally! woul$ it not be great to be able to rea$ te twenty measure$ values5 Of course! yesM (ake te ?2onnect Wire@ tool an$ again go to te rigt an$ si$e of te Ai$$le Icon - our A)L(-'( AE"# Icon- .in$ te terminal labelle$ by te name ?rea$ings@- "gain use te %igt an$ mouse button to get te two ?$rop-$own@ tables use$ in step ,6- 1ut tis time! we cose te ?Indicator@ button instea$ of te ?2ontrol@ button! since we wis to $isplay O)(')( $ata an$ not to enter IN')( $ata tat reEuires using te ?2ontrol@ button- "fter clicking on te ?In$icator@ button! go to te ?.ront 'anel@ an$ notice tat tere now appears a tir$ ?rea$ings@ win$ow tat will $isplay one out of twenty of te measure$ values- (o $isplay eac of te twenty rea$ings use te ?an$@ tool- ! an$ position it on te ?)'@ or ?Bown@ toggle switces locate$ on te left si$e of te $isplay ?rea*ings@ win$ow- Note tat te first rea$ing is $esignate$ by te in$eD + N Hero! an$ not by te in$eD ,- ,9- WeLre finally rea$y to run te program an$ take twenty voltage measurements- Fit te run button an$ see if te BAA respon$s- We ope it $oesM If te BAA $oesnLt respon$ ceck te following: a- Is te 0'I1 2able connecte$5 b- Is te BAA 'rogramme$ for te F'I1 :0'I1; bus! is its a$$ress set to ,/! an$ is te language set to #2'I :#tan$ar$ 2omman$s for 'rogrammable Instruments;5 c- If tere is no response! turn off te '2 an$ reprogram it from te beginningM #orry! but sometimes te '2 ?angs up@ an$ refuses to respon$M ,7- "ssuming tat te BAA response! by observing te ?O@ in$icator flasing twenty times on te front panel of te BAA! go to te ?.ront 'anel@ of your program an$ rea$ off te twenty rea$ings- /*<*,/*=,-$oc 7 Version! .eb- /++/ Controls Palette (e (ontrols palette is available only on te ?5ront Panel6- (e (ontrols palette contains te front panel controls an$ indicators you use to create te user interface- #elect Win*ow show (ontrols Palette or rigt-click te front panel workspace to $isplay te ?(ontrols6 palette- Jou can place te ?2ontrols@ palette anywere on te ?.ront 'anel@ screen- Note tat tere are also In*icator icons as well as te (ontrol icons in tis palette- ,o)e Useful Buttons That %ppear ;n ;ne ;f The /ori<ontal Upper 4bars6 ?run@ button: "lso tere is te ?2ontinuous run@ button: (ere is te ?#top@ button: (ere is also te ?'ause@ button: (o BELE(E! bring te ?an$@ cursor on te obIect you wis to $elete- Now click on te left button of te mouse- .inally it te ?Belete@ key on your keyboar$- /*<*,/*=,-$oc K Version! .eb- /++/ ,a=ing the Instru)ent >ea*ings on a $is0ette #ay tat we are intereste$ in analysing te /+ $ata rea$ings tat we receive$ from our BAA- Jou can use some of te statistical an$ matematical tools provi$e$ by LabVIEW3 or you can coose to eDport te $ata to some program like AatLab- Let>s try to eDport te $ata by writing it to a floppy $iskette- (ere is a special icon calle$ ?Write to #prea$seet .ile-vi@ Icon tat $oes tis task- (o fin$ tis icon! refer to page 6 an$ inspect te ?.unction 'alette@- Notice on te >ight han* si*e an$ on te Thir* row! tere is a icon aving a picture of a ?.loppy Bisk@- 2lick on tis icon to get a $rop-$own table entitle$ ?.ile I8O@- (is table contains tree rows of many icons- 2oose te first icon tat appears on te Upper Left an$ corner N it is name$: ?Write to #prea$seet .ile-vi@- Brag tis ?Write to #prea$seet .ile-vi@ Icon onto your ?1lock Biagram@ an$ attac a wire- cable between its input terminal entitle$ ?,$ $ata@ an$ between te output terminal of te ?A)L(-'( AE"#@ Icon3 refer to te ?1lock Biagram@ on page * for $etails- (e ?Write to #prea$seet .ile-vi@ Icon will ask you were to ?eDport@ or to ?write@ te $ata :$iskette! ar$ $isk! sprea$ seet! ect-;- We ope tis intro$uction to te 0'I1 1us an$ LabVIEW will elp you program more sopisticate$ interfacing applications in te futureM In anoter write up! we eDplain ow you can write your own driver programs using te #2'I comman$s :scientific comman$s for programmable instruments; an$ te two special ?VISA Write@ an$ ?VISA Read@ icons of National Instruments- 0oo$ luckM