T31505 Solution 53RevCd1文档格式.docx
《T31505 Solution 53RevCd1文档格式.docx》由会员分享,可在线阅读,更多相关《T31505 Solution 53RevCd1文档格式.docx(15页珍藏版)》请在冰豆网上搜索。
““Indicatesdialogboxbuttons,tabs,menusetc.
BoldIndicatesimportanttopics
Indicatesstart/explanationofstudentactivity
5.3.3
SolutionSteps
WewillbewritingsomeverysimpleandbasiccodetoruninProgram2intheSxx_ReactorAppapplicationasanintroductiontousingthePOUeditorfunctions.
NOTE!
Theeditormustbeinonoff-linemode!
5.3.3.1DeclareVariables
☞OpenProgram2inapplicationSxx_ReactorApp.
1.MakesurethatControlBuilderMisinofflinemode
2.ExpandtheApplicationsobjectandselectProgram2locatedunderyourSxx_ReactorAppobject.YoucanopenthePOUforthisprogrameitherbydouble-clickingProgram2orright-clickingandselecting“Editor”fromthecontextmenu.
3.
Locatetheavailablepanes,tabs,andmenuitemstoallowyoutonavigateintheeditorwindow.
☞
Declare4BoolIOvariablescalledSW1,SW2,SW3,andLAMP1withnoattributes.
4.Makesureyouareselectedtothe“Variables”tabinthedeclaration(upper)paneinthePOUeditorandenterthenamesofthevariableinthe“Name”column.
5.PlaceyourcursorintheDataTypecolumnandpress<
CTRL-J>
andselectthedatatype“BoolIO”.
6.Alsotryselectingthe“Insert…”IconontheupperrightcornerofthePOUeditorwindow.
7.
Deletetheretainattributeswhichbydefaultwillbeaddedwhencreatingvariables.
Selecttheentire“Attributes”columnbyclickingonthecolumnheaderanddeleteallentriesbypressingthe“delete”keyonthekeyboard.
8.Ormarkwiththemouseandrightclick,select“Clear”
9.
CheckthePOUforerrors.Inthetab“check”the0Errors,0warnings
10.Save
5.3.3.2
WritingLogic
☞ThelogicmustvaluatethreeDigitalInputsandsetaDigitalOutputaccordingtothelogicdiagrambelow:
11.TypethefollowinglinedirectlyintheCodePaneareaintheeditor.
Lamp1.Value:
=(SW1.ValueANDSW2.Value)ORSW3.Value;
12.
ThealreadydefinedvariablescanbemarkedfromalistusingkeyboardCtrlJ
Thefollowingkeyboardcodecanbeused:
Ctrlj,arrowdown,selectSW1,Enter,
.(dot),arrowdown,selectValue,Enter.
Arrowdowncanbereplacedbytypingthefirstletterintheitemofthelist
13.Selectthekeyboard.(dot)behindtheSW1andtheValuewillbebrowsed
14.Selectthe‘Check’Iconinthetoolbar:
Youshouldget0Errorsand0Warnings.
15.SaveandclosethePOUeditor.
16.
Select“TestMode”.
17.Clickthe“Continue”buttonfortheOnLineChangeanalysisdialogandobservethatControlBuilderentersthe“Test”mode
18.ChecktheMessagePaneinControlBuilder.
19.
TakeControlBuildertotheOff-linemodebypressingthe“StopTestMode”icononthetoolbar.
5.3.3.3ConnectingVariablestoIOChannels
☞ConnectthethreeswitchesontheDI810moduletotheSW1,SW2,andSW3variableyoucreatedinProgram2
20.OpenupthehardwarestructureintheControlBuilderanddoubleclickontheDI810moduleinthetree:
21.
ConnectthethreeswitchesontheDI810moduletotheSW1,SW2,andSW3variablesyoucreatedin“Program2”.Usetheiconsintheupperrightcorneroftheeditortochoosevariables.Openthetreetoviewthevariables,selectthe+
22.
Saveandclosetheeditorwhenfinished.
23.SelectDO810
24.ConnectthefirstchannelontheDO810moduletotheLamp1variableyoucreatedinProgram2.Checkforerrorsandthensaveandclosetheeditorwhenfinished.
25.DownloadandGoOnline.Select“Continue”
5.3.3.4
ViewingCodeinOnlineMode
☞CheckControlBuilderisintheOn-LinemodeandopenthePOUeditorforProgram2andobservethelogicisinon-linemode.
26.
ManipulatethethreeswitchesandobservethelightontheIOpanelwhilelookingatyourlogic.
27..
RightclickonthevariableintheDeclarationPanetogetinformationaboutthevariableandalsotoopentheI/Oeditor.on
28.
Forinformationrightclickatavariable
29.ReadtheinformationregardingtoI/OaddressandApplication
30.Selectthehardwaretab“Status”toviewtheconnections
5.3.3.5
ChangingtheOnlineViewofStructuredText(ST)
31.SelectTools>
Setupfromtheprogrameditormenubar.
32.SelectradiobuttonforFunctionDiagram,Select“OK”
33.Viewthelogicon-lineintheFunctionDiagramlanguage.
34.Viewthelogicon-lineintheLadderlanguage.
35.Changeaswitchatthepanel.
36.ChangetheviewbacktoText.
ForcingIO
37.OpenthehardwareeditorscreenfortheDI810modulebyright-clickingtheSW1variableintheprogrameditorandselecting“I/OEditor”fromthecontextmenu.
38.Selectthe“Status”,andforceoneormorevariables.ObservetheresultingchangesinyourProgram2editor’scodepaneasyouforceandreleaseforcesonvariables.