USS4tip.docx
《USS4tip.docx》由会员分享,可在线阅读,更多相关《USS4tip.docx(31页珍藏版)》请在冰豆网上搜索。
USS4tip
UsingUSS4ProtocolInstructionsto
CommunicatewithDrives
VERSION:
1.1
DATE:
07/2001
ThistipdescribestheUSS4ProtocolinstructionsthatallowtheS7–200tocontrolaMicroMasterdrive(MM3andMM4).
Withthesenewinstructions,youcancontrolthephysicaldriveandreadandwritedriveparameters
ChapterOverview
Section
Description
Page
1.1
USS4ProtocolInstructionRequirements
2
1.2
ProgrammingSequence
4
1.3
USS4ProtocolInstructions
5
1.4
ConnectingMM3Drives
19
1.5
ConnectingMM4Drives
20
1.6
MM3DriveSetup
22
1.7
MM4DriveSetup
24
ThisTipdoesnotpurporttocoveralldetailsorvariationsinequipment,nordoesitprovideforeverypossiblecontingency.Yourapplicationmaybedifferentfromthosecontemplatedherein.ItisyourresponsibilitytousetheSIMATICS7-200properlyinyourapplication.ThisTipdoesnotrelieveyouoftheresponsibilitytousesoundpracticesinapplication,installation,operationandmaintenance.ByusingthisTip,youacknowledgethatSiemensshallnotbeliableunderanytheoryfordamagesorpersonalinjuryresultingfromsuchuse.
SiemensreservestherighttomakechangesinthisTipatanytimewithoutnoticeorobligation.ShouldaconflictarisebetweenthesuggestionsinthisTipandotherSiemenspublicationssuchastheS7-200ProgrammableControllerSystemManualortheSIMATICS7/M7/C7ProgrammableControllersCatalogST70,theotherpublicationshalltakeprecedence.
Copyright©2001SiemensEnergy&Automation,Inc.AnyformofduplicationordistributionoftheseTipsorexcerptshereofisprohibitedwithouttheexpressconsentofSiemensEnergy&Automation,Inc.
1.1USS4ProtocolInstructionRequirements
TheUSS4ProtocolinstructionsrequirethefollowingresourcesfromyourCPU:
∙Size3000bytes
∙Port0(only)
∙14subroutinesand3interrupts
∙Vmemorysize400bytesanda16–bytebufferforsomeinstructions
ResourceUsage
USS4ProtocolInstructionusesresourcesasshownbelow:
∙Port0:
WhenPort0isbeingusedforUSS4Protocolcommunications,itcannotbeusedforanyotherpurpose,includingcommunicatingwithSTEP 7-Micro/WIN.TheUSS4_INITinstructioncontrolsassignmentofPort0toUSS4ProtocolorPPI.OncePort0hasbeenassignedtoUSS4usage,Port0canonlybeusedagainforSTEP7-Micro/WINcommunicationbyaprogrammedreassignmentviaanotherUSS4_INITinstruction,orbysettingtheMODEswitchtoSTOP.Stoppingcommunicationtothedriveswillcausethedrivestostop.ItisrecommendedthatduringprogramdevelopmentofUSS4Protocolapplications,thedevelopershoulduseaCPU226,orEM277PROFIBUS-DPinconjunctionwithaPROFIBUSCPcardinthePC.ThisallowsasecondcommunicationsporttobeusedforSTEP7-Micro/WINmonitoringoftheapplicationwhileUSS4Protocolisrunning.
∙AllSMlocationsassociatedwithFreeportcommunicationonPort0willbeaffectedbyUSS4protocolinstructions.
∙Userprogramspace:
Inadditiontothespaceoccupiedbyeachinstruction,thereisauserprogramspaceoverheadofupto3000bytesoccupiedbyUSS4protocolsupportroutines
∙Vmemory:
A400byteblockofVmemory,startingatVB4723,isreservedforUSS4variables.A16–bytecommunicationsbuffer,startingatauserassignedlocation,isrequiredforsomeinstructions.ItisrecommendedthatauniquebufferbeassignedforeachinstanceofUSS4protocolinstructions.
∙14subroutinesand3interruptsaretakenbyUSS4protocol.
DriveCommunicationsTime
CommunicationwiththedriveisasynchronoustotheCPUscan.SeveralCPUscanswillusuallycompletewhileonedrivecommunicationtransactioncompletes.Thisdependsonthenumberofdrivespresent,thebaudrate,andthescantimeoftheCPU.Table1–1showscommunicationstransactiontimes.OnceaUSS4_INITinstructionassignsPort0toUSS4Protocol,theCPUregularlypollsallactivedrivesattheintervalsshowninTable1–1.Thetimeoutparameterofeachdrivemustbesettoallowforthispolltime.
Table1–1DriveCommunicationsTimes
BaudRate
TimeBetweenPolls
totheActiveDrives(ms)
1200
(400maximum)*numberofdrives
2400
(200maximum)*numberofdrives
4800
(110maximum)*numberofdrives
9600
(70maximum)*numberofdrives
19200
(50maximum)*numberofdrives
38400
(40maximum)*numberofdrives
Restriction
OnlyoneUSS4_RPM_xorUSS4_WPM_xinstructioncanbeactiveatatime.TheDoneoutputofeachinstructionshouldsignalcompletionbeforeuserlogicinitiatesanewinstruction.UseonlyoneUSS4_DRV_CTRLinstructionforeachdrive.
1.2ProgrammingSequence
TheprogrammingsequenceforusingUSS4Protocolinstructionsisshownbelow.
1.PlacetheUSS4_INITinstructionintheuserprogram.TheUSS4_INITshouldonlybecalledforonescantoinitiateorchangetheUSS4communicationparameters.Seepage1–5formoreinformationabouttheUSS4_INITinstruction.
2.PlaceonlyoneUSS4_DRV_CTRLinstructionperactivedriveinyourprogram.YoumayaddasmanyUSS4_RPM_xandUSS4_WPM_xinstructionsasyouwish,butonlyoneofthesemaybeactiveatatime.
3.Configurethedriveparameterstomatchthebaudrateandaddressusedintheprogram.RefertotheDriveSetupinSection1.5.
4.ConnectthecommunicationscablebetweentheCPUandthedrives.Itisveryimportantthatanycontrolequipmentthatisconnectedtothedrive(suchasaPLC)isconnectedtothesamegroundorstarpointasthedrivebyusingashort,thickcable.
Caution
Interconnectingequipmentwithdifferentreferencepotentialscancauseunwantedcurrentstoflowthroughtheinterconnectingcable.
Theseunwantedcurrentscancausecommunicationerrorsorcandamageequipment.
Besureallequipmentthatyouareabouttoconnectwithacommunicationcableeithersharesacommoncircuitreferenceorisisolatedtopreventunwantedcurrentflows.SeethesectiononGroundingandCircuitReferencePointforUsingIsolatedCircuitsintheSIMATICS7-200ProgrammableControllerSystemManualformoreinformation.
Theshieldmustbetiedtoachassisgroundorterminal1onthe9-pinconnector.Itisrecommendedthatyoutieterminal20VontheMicroMasterdrivetochassisground.
_____________________________________________________________________________
Note
IfyoucannotreadallthevariablesontheUSSinstructionblocks,selectView>Zoomfromthemenuandthenincreasethegridwidth.
_____________________________________________________________________________
1.3USS4ProtocolInstructions
USS4_INIT
TheUSS4_INITinstructionisusedtoenableandinitialize,ortodisableMicroMasterDrivecommunication.BeforeanyotherUSS4Protocolinstructioncanbeused,theUSS4_INITinstructionmustbeexecutedwithouterrorsbeingreturned.TheinstructioncompletesandtheDonebitissetimmediately,beforecontinuingtothenextinstruction.
TheinstructionisexecutedoneachscanwhentheENinputison.TheUSS4_INITinstructionshouldbeexecutedexactlyonceforeachchangeincommunicationstate.Therefore,theENinputshouldbepulsedonthroughanedgedetectionelement.OnceUSS4Protocolhasbeeninitiated,itmustbedisabledbyexecutionofanewUSS4_INITinstructionbeforeachangeininitializationparameterscanbemade.
ThevaluefortheUSSinputselectsthecommunicationprotocol.1assignsport0toUSSprotocolandenablestheprotocol.0assignsport0toPPIanddisablestheUSSprotocol.
BAUDsetsthebaudrateat1200,2400,4800,9600,19,200,or38,400.
ACTIVEindicateswhichdrivesareactive.Somedrivesonlysupportaddresses0through30.Figure1–1showsthedescriptionandformatoftheactivedriveinput.AnydrivethatismarkedasACTIVEisautomaticallypolledinthebackgroundtocontrolthedrive,collectstatus,andpreventseriallinktimeoutsinthedrive.RefertoTable1–1onpage1–3tocomputethetimebetweenstatuspolls.RefertoSection1.5forinformationabouthowtoconfiguretheseriallinktimeoutparameter.
Figure1-1ActiveDriveDescriptionandFormat
WhentheUSS4_INITinstructioncompletes,theDONEoutputisturnedon.TheERRoutputbytecontainstheresultofexecutingtheinstruction.Table1–10onpage1–16definesthepossibleerrorconditionsthatmayresultfromexecutingtheinstruction.
Table 1–2showstheoperandsanddatatypesoftheUSS4subroutines.
Table1-2OperandsandDataTypesfortheUSS4_INITSubroutine
Inputs/Outputs
Operands
DataTypes
USS
VB,IB,QB,MB,SB,SMB,LB,AC,Constant,*VD,*AC,*LD
BYTE
BAUD
VW,IW,QW,MW,SW,SMW,LW,T,C,AIW,Constant,AC*VD,*AC,*LD
WORD
ACTIVE
VD,ID,QD,MD,SD,SMD,LD,AC,Constant,*VD,*AC,*LD
DWORD
DONE
I,Q,M,S,SM,T,C,V,L
BOOL
ERR
VB,IB,QB,MB,SB,SMB,LB,AC,*VD,*AC,*LD
BYTE
USS4_DRV_CTRL
TheUSS4_DRV_CTRLinstructionisusedtocontrolanACTIVEMicroMasterDrive.TheUSS4_DRV_CTRLinstructionplacestheselectedcommandsinacommunicationbuffer.Commandsinthebufferaresenttotheaddresseddrive(DRIVEparameter),ifthatdrivehasbeenselectedintheACTIVEparameteroftheUSS4_INITinstruction.EachdriveshouldhaveonlyoneUSS4_DRV_CTRLinstruction.
TheENbitmustbeontoenabletheUSS4_DRV_CTRLinstruction.Typically,thisinstructionisalwaysenabled.
RUN(RUN/STOP)indicateswhetherthedriveison
(1)oroff(0).WhentheRUNbitison,theMicroMasterDrivereceivesacommandtostartrunningatthespecifiedspeedanddirection.Inorderforthedrivetorun,thefollowingmustbetrue:
∙DRIVEmustbeselectedasACTIVEinUSS4_INIT.
∙OFF2andOFF3mustbesetto0.
∙FAULTandINHIBITmustbe0.
WhenRUNisoff,acommandissenttotheMicroMasterDrivetorampthespeeddownuntilthemotorcomestoastop.
TheOFF