Page 687 - 3-2
P. 687
sig_f<=0;
end
else
begin
if(sig==1)
begin
case(state)
idle:
begin
if(sw1==1)
begin
if(buff_cnt>=25000000) state<=right;
else buff_cnt<=buff_cnt+1;
end
end
right: // 옆으로 이동 시작 떼면 다음 상태로,
begin
buff_cnt<=0;
sig_f<=0;
if(!sw1)
begin
if(buff_cnt2>=25000000)state<=right_stop;
else buff_cnt2<=buff_cnt2+1;
end
if(limr==1 ) state<=right_stop;
end
right_stop: // 옆으로 이동 멈춤 두번째 스위치 누르면 다음 상태로,
begin
buff_cnt2<=0;
if(sw2==1)
begin
if(buff_cnt>=25000000) state<=up;
else buff_cnt<=buff_cnt+1;
end
end
up: // 올라가다가 떼면 다음 상태로
begin
buff_cnt<=0;
if(!sw2)
begin
if(buff_cnt2>=25000000) state<=front;
else buff_cnt2<=buff_cnt2+1;
end
if(limt==1 ) state<=front;
end
- 687 -