Page 198 - MDP2020-2
P. 198
| 인천전자마이스터고등학교 ·············································································································
192
begin
adc_time <= adc_time + 1;
end
else
begin
adc_time <= 0;
end
end
end
always@(posedge clk, negedge rst)
begin
if(!rst)
begin
state <= s_IDLE;
end
else
begin
case(state)
s_IDLE : state <= s_START;
s_START : state <= (adc_time > 102)? s_START : (eoc == 0)? s_WAIT : s_START;
s_WAIT: state <= (eoc == 1)? s_OE_SIG : state <= s_WAIT;
s_OE_SIG: state <= (adc_time > 14)? s_CAPTURE : s_OE_SIG;
s_CAPTURE: state <= s_IDLE;
default: state <= s_IDLE;
endcase
end
end
always@(state, adc_time)
begin
case(state)
s_IDLE: begin
channel = 0;
ale = 0;
start = 0;
oe = 0;
end
s_START: begin
oe = 0;
if(adc_time < 2)
begin
channel = 0;
ale = 0;
start = 0;
end
else if(adc_time < 4)