[an error occurred while processing this directive]
|
привожу код процесса приемника clk=14.7456мг,
RxProc : process(Clk)
variable BitPos : INTEGER range 0 to 11:=0; -- Position of the bit in the frame
variable SampleCnt : INTEGER range 1 to 128; -- Count from 0 to 3 in each bit
begin
if falling_Edge(Clk) then
case BitPos is
when 0 => -- idle
RxAv <= '0';
if RxD = '0' then -- Start Bit
SampleCnt := 1;
BitPos := 1;
endif;
when 10 => -- Stop Bit
-- next is idle
RxAv <= '1'; --принят байт
DataO <= RReg; -- Store received byte
when others =>
if (BitPos >= 2 and SampleCnt = 64) then -- середина импульса
RReg(BitPos-2) <= RxD; -- Deserialisation
end if;
end case;
if (BitPos = 11 or BitPos = 0) then
BitPos:=0;
RxAv <= '0';
else
if SampleCnt = 128 then -- Increment BitPos on 128
BitPos := BitPos + 1;
end if;
end if;
if SampleCnt = 128 then
SampleCnt := 1;
else
sampleCnt := SampleCnt + 1;
end if;
end if;
end process;