Treść książki

Przejdź do opcji czytnikaPrzejdź do nawigacjiPrzejdź do informacjiPrzejdź do stopki
CHAPTER1EXERCISEL1:PCSEQUENTIALCONTROL
1.2.1
Mooremachineforacipherlock
LetusdesignaMooremachineforthesystemdiscussedabove.Letussettheinitial
state(S1)tothelockbeingclosed,thespeaker-turnedoff,andthelockwaitingforthe
codetobeentered.Eitherofthetwoactionscanbetakenatthistime:the“0”orthe
“1”buttoncanbepressed.Formallyspeaking,eachsignalcouldchange,e.g.,thegate
closuresensorcouldchangeitsstate,butthisisinconsistentwithlogic,nottomention
thatwecannotreacttothischange(noneofourexecutiveelementspreventsthegate
frombeingopened).Nothinghappenswhenpressingtheresetbuttonbecausenothing
hasbeenenteredyet.Sincewecanonlyperformtwoactions,weexpecttwotransitions.
S2isastaterepresentingenteringthe“0”code;itisanincorrectcode,whilethesecond
state(S3)ispressingthe“1”code,thusstartingthecorrectcode.Bothstatesarerelated
toonlypartiallyentering(correctorincorrect)thecode,sotheyshouldtriggerthesame
changesinthesystemornottriggerthematall;toavoidguidingtheenteringofthecode
viasignallingthecorrectdigits,thecodeisconfirmedascorrectonlyafterithasbeen
enteredfully(3characters).Thelockwillnotchangeanyoutputregardlessofthebutton
pressed,nottocomplicatethesystem.
InstateS2,threeoptionsexist:buttonBo,B1,orRmaybepressed.Regardlessof
whetherBoorB1ispressed,thesystemmovestothenextstate(S4),whichisanalogous
tothecurrentone,indicatingthatthesecondcharacterhasbeenenteredeventhough
thiscombinationisincorrect.Pressingtheresetbuttoncausesanimmediatereturnto
thestartingpoint.InstateS3,wecanpressBo;thecode“10”isentered,whichisthe
beginningofthecorrectcode.Therefore,weshouldmovetothestateindicatingthatthe
secondcorrectcodecharacterhasbeenentered(S5).IfthebuttonB1ispressed,wemove
tostateS4becausetheenteredcombinationisincorrectandtwocharactershavebeen
entered.TheresetbuttonleadsstraighttostateS1.
InstateS6anincorrectlyenteredcodegeneratesasoundsignal(S=1)untilthereset
buttonispressedandwereturntostateS1.PressingbuttonsBoandB1inthisstateis
ignored.StateS7indicatesacorrectlyenteredcombination,soweunlockthelock(L=1)
untilthegateisopened(G=0).Whenthegateopens,wemovetostateS8.Weassume
thattheresetbuttoninthisstatealsoleadstoS1,thuscancelingthecontrolsignalto
openthegate.InstateS8wewaitforthegatetobeclosed,whichcausesatransitionto
stateS1.Here,resettingthestatedoesnotmakesensebecausethegatehasalreadybeen
opened,soitistoolatetocanceltheaction.Thedesignedstatemachineispresentedin
Fig.1.3,where
c21=Bo
c31=B1
c42=BoB1
c43=B1
c53=Bo
c64=BoB1
c65=Bo
c75=B1
c87=G
c18=G
c12=c13=c14=c15=c16=c17=R
14
Q1L,S
Q2
Q3
Q4
Q5
Q6S
Q7L
Q8
(1.7)