176
Analogmultiplexer:AQ
Analogramp:AQ
Analogmath:AQ
PIcontroller:AQ
Datalatchingrelay:AQ
Up/Downcounter:Cnt
ParameterpappliestothedisplayofV1,V2,V3,V4andAQinamessagetext.
Descriptionofthefunction
Theanalogmathfunctioncombinesthefouroperandsandthreeoperatorstoformanequation.The
operatorcanbeanyoneofthefourstandardoperators:+,-,*,or/.Foreachoperator,youmustseta
uniquepriorityofHigh("H"),Medium("M"),orLow("L").Thehighoperationwillbeperformedfirst,
followedbythemediumoperation,andthenbythelowoperation.Youmusthaveexactlyoneoperation
ofeachpriority.Theoperandvaluescanreferenceanotherpreviously-definedfunctiontoprovidethe
value.Theanalogmathfunctionroundstheresulttothenearestintegervalue.
Thenumberofoperandvaluesisfixedatfourandthenumberofoperatorsisfixedat3.Ifyouneedto
usefeweroperands,useconstructionssuchas"+0"or"*1"tofilltheremainingparameters.
YoucanalsoconfigurethebehaviorofthefunctionwhentheEnableparameter"En"=0.Thefunction
blockcaneitherretainitslastvalueorbesetto0.
Possibleerrors:Zerodivisionandoverflow
Iftheanalogmathfunctionblockexecutionresultsinzerodivisionoroverflow,itsetsinternalbitsthat
indicatethetypeoferrorthatoccurred.Youcanprogramananalogmatherrordetectionfunctionblock
inyourcircuitprogramtodetecttheseerrors,andtocontroltheprogrambehaviorasneeded.You
programoneanalogmatherrordetectionfunctionblocktoreferenceonespecificanalogmathfunction
block.
Examples
Thefollowingtablesshowsomesimpleexampleanalogmathblockparameters,andtheresulting
equationsandoutputvalues:
V1 Operator1 V2 Operator2 V3 Operator3 V4
12 +(M) 6 /(H) 3 -(L) 1
Equation:(12+(6/3))-1
Result:13
V1 Operator1 V2 Operator2 V3 Operator3 V4
2 +(L) 3 *(M) 1 +(H) 4
Equation:2+(3*(1+4))
Result:17
V1 Operator1 V2 Operator2 V3 Operator3 V4