You are on page 1of 4

6/25/2015

APPENDIXELadderdiagraminstructions

IntroductiontoPLCcontrollers
onlineFREE!
Previouspage

Tableofcontents

Index
Developmentsystems
Contactus

NextPage

APPENDIXELadderdiagraminstructions(3/3)

E.51BCDDIVIDEDividestwovalues
Description

InstructiondividesthecontentsoflocationDdwithcontentsoflocationDr.Theresultof
divisionisstoredinlocationsRandR+1.Thefirstcontainstheroundedoffresultof
division,whileR+1containsthefraction.

Ladder
symbol

Limitations

WordsDM6144DM6655cannotbeusedasoperandR.

Flag

ERflagchangesstatetoONifthecontentsofwordsDdandDrarenotBCD.
EQflagchangesstatetoONiftheresultequals0.

Example

UponfulfillingtheconditiononbitIR000.00,instructiondividesthevalueofmemory
locationIR216bythevalueofmemorylocationHR09.Theresultisstoredintotwo
sequentialmemorylocationsDM0017andDDM0018.Theresultisstoredsothat
DM0017containsroundnumberandDM0018containsthefraction.

http://www.mikroe.com/old/books/plcbook/app_e/app_e2.htm

1/4

6/25/2015

APPENDIXELadderdiagraminstructions

E.52DOUBLEBCDADDAddstwo32bitwords
Description

InstructionaddsvaluesfromaddressesAuandAu+1tovaluesfromaddressesAd,Ad+1
andcarrybitCY.Iftheresultexceeds99999999carrybitCYisset.

Ladder
symbol

Limitations

WordDM6144DM6655cannotbeusedasoperandR.

Flag

ERflagchangesstatetoONifthecontentsofwordsAuandAdarenotBCD.
EQflagchangesstatetoONiftheresultequals0.
CYflagchangesstatetoONifthereisacarryintheresult.

E.53DOUBLEBCDSUBTRACTSubtractstwo32bitwords
Description

InstructionsubtractsthecontentsoftwowordsSu+1andSuwithcarrybitCYadded
fromthecontentsofwordsMi+1andMi.TheresultisstoredintomemorylocationsR+1
andR.Iftheresultisnegative,carrybitCYissetand10complementoftheresultis
storedintoR.Togettherealresult,contentsofRshouldbesubtractedfromzero.

Ladder
symbol

Limitations

WordsDM6144DM6655cannotbeusedasoperandR.

Flag

ERflagchangesstatetoONifthecontentsofwordsMi,Mi+1,Su,Su+1arenotBCD.

http://www.mikroe.com/old/books/plcbook/app_e/app_e2.htm

2/4

6/25/2015

APPENDIXELadderdiagraminstructions

EQflagchangesstatetoONiftheresultequals0.
CYflagchangesstatetoONiftheresultisnegative.

E.54DOUBLEBCDMULTIPLYMultipliestwopairsofwords
Description

InstructionmultipliesvaluesoflocationsMd,Md+1withthevaluesoflocationsMr,
Mr+1.Theresultisstoredinto4locations:R,R+1,R+2iR+3.

Ladder
symbol

Limitations

WordsDM6144DM6655cannotbeusedasoperandR.

Flag

ERflagchangesstatetoONifthecontentsofwordsMr,Mr+1,MdandMd+1arenot
BCD.
EQflagchangesstatetoONiftheresultequals0.
CYflagchangesstatetoONifthereisacarryintheresult.

E.55DOUBLEBCDDIVIDEDividestwopairsofwords
Description

InstructiondividesthecontentsoflocationsDd,Dd+1bythecontentsoflocationsDri
Dr+1.TheresultisstoredintolocationsRandR+1whilelocationsR+2andR+3contain
thefraction.

Ladder
symbol

Limitations

WordsDM6144DM6655cannotbeusedasoperandR.

Flag

ERflagchangesstatetoONintwocases,ifthecontentsofwordsDd,Dd+1,Drand

http://www.mikroe.com/old/books/plcbook/app_e/app_e2.htm

3/4

6/25/2015

APPENDIXELadderdiagraminstructions

Dr+1arenotBCDorifthecontentsoflocationsDrandDr+1equalzero.
EQflagchangesstatetoONiftheresultequals0.

E.56BINARYADDBinaryaddition
Description

InstructionexecutesbinaryadditionofwordsAuandAdwithcarrybitandstoresthe
resultintomemorylocationR.IftheresultisgreaterthanFFFFthecarrybitCYisset.

Ladder
symbol

Limitations

WordsDM6144DM6655cannotbeusedasoperandR.

Flag

ERflagchangesstatetoONincaseoferror.
EQflagchangesstatetoONiftheresultequals0.
CYflagchangesstatetoONiftheresultisgreaterFFFF.
OFflagchangesstateiftheresultisgreaterthan+32.767(7FFF).
UFflagchangesstateiftheresultislowerthanod+32.768(7FFF).

Example

Theexampledemonstrateshowthe

http://www.mikroe.com/old/books/plcbook/app_e/app_e2.htm

4/4

You might also like