problem with VHDL loop

Status
Not open for further replies.

xilinx1001

Member level 3
Joined
Apr 3, 2013
Messages
60
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,781
Hi

I need to trigger a sensor for 12usec and giving a delay of 50msec and the process should be continuous with the clock

I wrote something like this which is running for only one trigger and become 0 forever

if(clk'event and clk = '1') then


if(clkdiv <= "000000000001001011000" ) then
trg <= '1';
clkdiv <=clkdiv+"0000000000000000000001" ;
else
if(clkdiv > "000000000001001011000" and clkdiv < "1001100010010110100000" ) then
trg <= '0';
if (clkdiv >"1001100010010110100000") then
clkdiv<="0000000000000000000000";

end if;
end if;
end if;


Please give comments on this code
 

First,
I don't think your code will pass a simple compiler parsing check...

Second,
It's not a loop - it's synchronous logic.

Third,
You should simulate everything - especially if you're a beginner.

Fourth,
Simulate again!
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…