0% found this document useful (0 votes)
28 views3 pages

Rules To Wire by Part II

Uploaded by

gerald.munoz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
28 views3 pages

Rules To Wire by Part II

Uploaded by

gerald.munoz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 3
Ni fait désormais partie de la nouvelle « division EN SAVOIR PLUS - HTTPS://WWW.EMERSON. COM/EN-US/NEWS/2023/EMERSON-COMPLETES-NFACQUISITION opérationnell detest et mesure Emerson, Rules to Wire By ~ Part II Updated Mar 70, 2020 \Welome Part Tao of ules to Wire By - guidelines or good LabVIEW programming practies. In the astisue of LR, Part One af thistle cussed general programming syle and guidelines or resting LABVIEW rot panels and user interaces. Generally suorthing suggest in tat sce could Be cite appl to any programming enronment~C/C+, Vu! Boi snd Lsb¥IEW, However, ths arc ie more LABVIEN focused a it fers guides for go LABVIEW progranining practice ofl when cresting Dock diagrams. Although st eic sugestion a a rl, da take this to teal, These tems are actualy colton of suggested sidelines te and practices that ecortmend Using when pragramming in LabVIEW. “measure up? (once you have designed your code anda out laf yout unctions you need to connec them withthe LabVIEW wing tool Hom you do this an tet sfect the success fre of your program Rule #32 -- Use clean lft right wiring with no hidden wire, Remember the ule fom Par One ofthis arc about consistent connector panes? Heres where they comin handy. ala your Connector panes ae constructed and laid out Slay, wing becomes snap. The output othe right of one VI det cannes to the input on thevight a he net one. the connector panes have the sme numb f terminal, no Bends inthe weil be needed ther Never rte 8 wire behind anything Whenever you do so, u cn n ange seal of he connections 8 wie may of may not hve Yow sso may forget about you de not eet Ts can bes bg problem if yu selec couple ftensin a oop orcas snd there 8 hide wre Behind. ven though he wire snot part ofthe loop you ae selecting, AbVIEW selects it So if you dete or move your oe you wil delete or move ths hidden wr, with unknown consequences fou are cy, you Wl ge a broken arow fn, you \wineverknow it hoppened ns you ty debugging hats ule #33 Avoid indiscriminate use of Remove Bad Wires ‘Ailough Ramave Bad Wires's 3 handy too, |simost neve use it Atays remember tht wil remove ay bad wte onthe dagram. ott hose you ae loking at. The other bs wrest lees may be pe of some code you at wring but hve not had chance to ‘inh ot. Delete them and you are bac to square one. More ofa problem though isthe wires that get deleted without generating any terre. Tink of sf register tat oes the wie to nil vale You most hey wll nt gt wing err, but itis vey the Vl work st you expect ito. Thik ofthe hous you might spend fining thi one or those of you wth Cor Basi programming background, think af command|in your etor nations you to delet al syntax eors a once Sounds sot of dangerous does Rule #34. Use double and tiple click to look for wing problems Say you arehaving swing problem. Wha the best way to ase it without using things ke Remove Bad Wires? ry dicing onthe vee yousre concerned aout, Single cet elec ne segment, double cs selects branch, and tpl lek eect the hol wie. til cick expecially stl for fing al places wie connacndo inching those you knw about snl hose you do net. One ror have sen hat isimpossible to comet any other way (shor of stating over is whan two input terminals get connected together. “Whenever you ty to wre the second input you wil gta broken aow because the terminals ave mule sources. Since th we den under he cone hy hidden wes sre nasty) you wilt se Liew, you yt delete bad wires, tl nat get nat litle stub between the terminals ane goos wie it conneted However, you tpl cick, th rng prod becomes mesial ‘vious Lean fr na bear or ater ay to mace sue Ihave wired tothe correct terminl of sub than tl lekng Rule #35 Use Create Contel/Constant as muchas possible. Sree the advent of LABVIEW 40, thas been posible to create constants on the digtam by simply Hight clcting and electing Cente {Constant Use his as mucha you can! Besides its simply t prevents a few nasty bug rom Bing intodced For ample, suppose ‘the s0bV using an enumerton. you wr number into the sub anlar change the enumeration, you il never Bethe wiser if instead, you create a constant net only de you get a icaly documented input but ifthe enumeration ever changed, you wl get a broken saw teling you to nee the Mp. Thnk of re hows of debugging you an save hs wa ca nat tress enough Keeping ‘your sagrams neat find that neat esgrams have fewer bugs, ook mere profession ae easier to inti, an were probably \wstten by someone who cesigned their code before they states writing it Sloppy diagrams on the other hand, are sual ful ofall ‘sorts of meaty uneupected bugs and ware written quickly, under duress, or withest much thought, Ihawe found that the feu etre runutst kes to make 3 nan agian often saves mehous oy in debugging ates For moi programs, or hing something we 38 sets ote in an effort just get things done na arger program, however Iswhat separates working and wsabe applications fom buggy and siffeut 0 operate bts of code. ll programs wll encounter ears ~ 2 well witen and professional application wil simply dal wth them bette. sno ino en) Paka ende @ xo Figure 6:The Aray and Custer Conte Rule #36 - Use Error and Errar Out darters Use the Earn and Out Chistes see gure 6 abo fom LabVIEW's Aray and Custer Contrl pet fo al Vis that cout encounter a problem while executing, Tis includes 28 npwvoutpr routines itoving les, serial ors, GPIB, These er clusters provide a easy and consatent nay of eportngerinfarmation oa cling VL. Thay can alsa be uted by the caller to contol he fw of exciton era noel 7 arout fsx Fi =] Figure 7: Use eror clusters to contel the flow of execution, Inthe example shown in Figur 7, the Open Fe mst complete before the Read Fi, and the Cos ile wil wait unt everyone is done Notice how visible eventing ena sequence sractre hing the dt, no ntemedae check for ors to cmp he saga ‘Algo, any stor occur prior oti VL. the Error in eter wil keep the WI rom exectng urnaceesriy Rule #37 Use NaN (Net-s-Number instead of eror clusters where appropiate. Some is, expec math freon, do not ned the extra information aresent in he arr eaters Insta, consider sting the output to NaN when the fonction fl There are numarus sevantage to doing this. Ft, nealing VI ante LabVIEW Not» NumberPatyRefrum to easly ee ifthe function was sucestl Second, NaN doesnt appear on graphs Sof you were plotting dat td suddenly your dat went out of bounds the graph woul show no data for that ital. toh you could use pl or minus Infity forthe same purpose they ae not 3 to ced for an cause verte nest apes on Your gph Rule #38 Do not show errors to early pass them down the lne. ‘When encountering mor you donot lv have to report then ight away ees dea with then athe appropiate tne. For cxample inthe fe input example above theteis no need te report ers a each point (ater opening reading, and closing) nen waituni the ens ve snnounes the ear. Not any wl yu spend ess time ang ena ced, but the operator il not have to del ‘th ae many enor messages. Of cute you nave something important to ay, go shes nel dos, Kmynot aly be best wt Rule #39 ~ Pas errors trough unchanged. Ifyou ate crating your ann inputoutout Vis, make sure to pas any incoming enors tough witout modification. Fr example fan ‘eror's detected peo 0 your skip your code an tlu he err passes o you ital, Do nt scidentally overwrite the sure at ror code oF he eer hinder may not be abet determine exactly what happened Rule #40 Think programmatically. De not always stop or show too many dialogs. Consider adaing ental message depsy instead of wig tor dsoge. Not only dossthis put the eosin one place butt eo prevents the opettr tom spending all the ine pressing OK ot Cane ike to se LabVIEW Queve to hanle my tor rezeging Irate the Queue in my main Van un the Remove Queue Elementin 2 separate loop. A my subVi simpy pa thir ‘ror or sts informaton tothe msn I ving a Insert Queue Element. Net onli thi pie, but he ure ofthe queue makes ‘very ecient as wel One word of warning To handle eos programiaticaly, you will ned to tn of! many of the advsory dialogs thot come up ae default in may ofthe bulla LabVIEW Vis Nat ll Vis ince ths option so you may hve to mod them your (Foran exampl ofthis se the sdisry dag inputn the help window in Figure @ elo) a sata Not Path Trt cen owihbatenra autre ie abo! er) Figure &: Handling erors ina central message dsplay may require dabling advisory dialogs in bullt-n Vis Rule #41 Try to close valid reference numbers, task IDs, et ‘One exception te skipping your code i ere is anincoming ears in any Case Vis Regardless of he status of any eros coming in you should nays ny to dose any hance, elerence numbers (thurs ais, pots ete that may have been opened by a eater “This prety easy n LASVIEW a here are numerous comparison functions to check ose fhe Ds te vai Rule #42 - Register user-defined error codes and use LaBVIEW's extra ones For many problems you wil a sutabe evorcads the erring onthe Adtional Numeric Constants Secon of LAbVIEW's Numetie function plete. Bu you ar by no meas ined to just these fr codes. LABVIEW prondes many mote er massages f you need mere tan the ulin ear cads, you can define your own Foraxampl, fen creat eri ever for anew pce of fauipant sm ung, There are sever] handy er coder the 12000 24D rnge hat ue th the die. ror code 240 indicates 3 Greove wile 1202 niet thatthe ver was unable to intlize te nerument. Aa there are many more ~ run stand lone copy ofthe General Eror Handler of ther you tl doo ind one, reat your om sing LABVIEW user ceinable ‘ees ram $000-99, For each coe you ute, make st toad an entry frit nthe user-defined input aay ol the General Em Handler, Rule #43 - Use negative error codes for fatal problems and postive for ll thes By LabVIEW convention if you ate unabe te complete your ask, et your err status it and make the code negative. Likewise the tase completa, but generated warnings make te ear code post. Ant Vica look atthe code ar dee whether oat to Rule #44 - Build good error messages, Use al ofthe tool at your dspos! to generate good, descitveeor messages. The le constant This W's path or Cll Chal il hep you determine excy whee the eoroccred. Ute Feat Inte String to nce not onthe curen Vs etr, but peop sit the errs of ny subs or math anevons A good er message wil make teaser forthe operator to determine what happened ‘A detaed err message wll ake techni suppor eae for you. Using standad styles and guidelines wilrasut in quicker development and more mastainabl, sable bugfee code Look fr more suggested LABVIEW style snd programming guidelines on debugging of more acvanced LABVIEW tpisin future eons of LT Inthe meantime, to implement some ofthese syle an srograming convention in your ow programs Ae 39 ade, Ina incided 3 bec 8 of Ve that demonstrates many ofthe techniques mentones in hate to Aves fo Wire By arcs Looe fr these exemple Vi on is ese's IR resource dk ‘As sated in Pat One the intent of hs aries to spark lscsson nthe LABVIEW communy resulting in mare LTR ares o tes to he ator on this topic to help promote the establishment and use of LabVIEW standar practices Remember thatthe whole point of preventing there soggertee guidelines eo get you thine shout Now you program. You may agree wth some of my suggestions orthese suggested guidelines may not be practical for your pregramming environment. The actual ye or tandard guideline is ot so Import the fact that you are actualy using standard Choose wha woke bet fr you or your programming tam and ck About LTR ao Technical Resource), Tis the eacing independent source of LabVIEW spec infermation Each TR ssa presents Powell tps and techniques and indus resource CD packed with is, ulus, soure code, and documentation ‘About tress Engineering Services Stress Engnearing, Nationa! Instant Select Integrator, develops custom sppiation wing many of Naor Instroments prosucts ning LBV EW, Relsted Links: Stress Eng necting Sones

You might also like