Hi,
I am trying to create an entity for a quadrature encoder, and I've just realized that I'm short of a major concept in VHDL. My entity as
- 2 inputs (A & B) and
- 1 (inout) for the output (counter counting # of time Encoder goes right/ left).
To know the direction that my encoder has been turned what I would need to do (in pseudo) is analyze both inputs A and B, when A rises then analyze B and if B is up the encoder incremented if B is low the encoder decremented
Then I also need to anayze when A goes down OR when B goes up....Here is the problem..
My process does not allow me to have more than one if ( rising_edge ) As well it does not allow me to have a rising_edge on A and a falling_edge on B. DOES ANYONE KNOW WHY...
Basically what I would want is the following to compile..
*******************************************************
*******************************************************
ENCODER_STATE: process(A)
begin
if ( rising_edge(A) ) then
if ( B = '1' ) then
EncoderValue_OUT <= EncoderValue_OUT + 1;
else
EncoderValue_OUT <= EncoderValue_OUT - 1;
end if;
end if;
if ( falling_edge(A)) then
if ( B = '1' ) then
EncoderValue_OUT <= EncoderValue_OUT + 1;
else
EncoderValue_OUT <= EncoderValue_OUT - 1;
end if;
end if;
end process;
*******************************************************
*******************************************************
FYI: I need to use the output as the counter because I am short in space. I am using a CPLD and have many encoder to "decode" it barely fits.
THE ERROR that I get from the compiler is the following:
Statement is not synthesizable since it does not holds its value under NOT (clock-edge) condition.