3
process(clkus1)
variable pwmgate:integer:=1;
variable pwmcount:integer:=0;
variable pwmcount_1:integer:=0;
variable count:integer:=0;
variable light:integer:=0;
begin
if clkus1'event and clkus1='1' then
if light=0 then
if count=0 then
count:=1;
pwmcount_1:=pwmcount_1+1;
else count:=0;
end if;
if pwmcount_1=pwmgate then
pwmout1<='1';
end if;
if pwmcount_1=99 then
pwmgate:=pwmgate+1
十分频计数模块-575字.pdf