课程设计说明书
ELSE
MYLIFT<=DOORCLOSE; END IF;
WHEN DOWN=> --电梯处在下降状态 POSITION<=POSITION-1; --电梯楼层数减一 POS:=POS-1;
IF POS>1 AND (STOPLIGHT(POS)='1' AND FDNLIGHT(POS)='1') THEN
MYLIFT<=STOP;
ELSIF POS=1 AND (STOPLIGHT(POS)='1' OR FUPLIGHT(POS)='1') THEN
MYLIFT<=STOP; ELSE
MYLIFT<=DOORCLOSE; END IF;
WHEN STOP=> MYLIFT<=DOOROPEN; WHEN DOOROPEN=> DOORLIGHT<='1'; IF UDSIG='1' THEN IF STOPLIGHT(POS)='1') THEN
CLEARUP<='1'; --清除当前层上升和停站请求 ELSE
CLEARUP<='1'; CLEARDN<='1'; END IF;
ELSIF UDSIG='0' THEN IF STOPLIGHT(POS)='1') THEN
CLEARDN<='1'; --清除当前层下降和停站请求 ELSE
CLEARUP<='1'; CLEARDN<='1'; END IF;
24
POSITION<3 AND (FUPLIGHT(POS)='1' OR
POSITION>1 AND (FDNLIGHT(POS)='1' OR
课程设计说明书
END IF;
MYLIFT<=DOORWAIT1; END CASE; END IF; END IF;
END PROCESS CTRLIFT;
CTRLIGHT:PROCESS(RESET,BUTTONCLK) --信号灯控制进程 BEGIN
IF RESET='1' THEN --复位,寄存信号清零 FUPLIGHT<=\ FDNLIGHT<=\ STOPLIGHT<=\ELSE
IF BUTTONCLK'EVENT AND BUTTONCLK='1' THEN IF CLEARUP='1' THEN --上升和停站请求清零 FUPLIGHT(POSITION)<='0'; STOPLIGHT(POSITION)<='0'; ELSE
IF F1UPBUTTON='1' THEN --记忆各层上升请求 FUPLIGHT(1)<='1'; ELSIF F2UPBUTTON='1' THEN FUPLIGHT(2)<='1'; END IF; END IF;
IF CLEARDN='1' THEN --下降和停站请求清零 FDNLIGHT(POSITION)<='0'; STOPLIGHT(POSITION)<='0'; ELSE
IF F2DNBUTTON='1' THEN --记忆各层下降请求 FDNLIGHT(2)<='1'; ELSIF F3DNBUTTON='1' THEN FDNLIGHT(3)<='1'; END IF; END IF;
25
课程设计说明书
IF STOP1BUTTON='1' THEN --记忆各层停站请求 STOPLIGHT(1)<='1'; ELSIF STOP2BUTTON='1' THEN STOPLIGHT(2)<='1'; ELSIF STOP3BUTTON='1' THEN STOPLIGHT(3)<='1'; END IF; END IF; END IF;
END PROCESS CTRLIGHT;
PROCESS(POSITION) BEGIN
IF POSITION=1 THEN DOUT1<=\ELSIF POSITION=2 THEN DOUT1<=\ELSIF POSITION=3 THEN DOUT1<=\END IF; END PROCESS;
END ARCHITECTURE ONE;
--楼层显示进程 26