Wrong works jump to the interrupt handler Timer0 Overflow.
v5.0 has no this bug.
Please check it out.
Code: Select all
program MyProject;
{ Declarations section }
//atmega8
var
w1 : sbit at portb1_bit;
w1_Direction : sbit at ddb1_bit;
pwm_tmp,pwm_w1: byte;
Procedure Timer0Overflow_ISR(); org IVT_ADDR_TIMER0_OVF ;
begin
pwm_tmp:=pwm_tmp+1;
if pwm_tmp>99 then
pwm_tmp:=0;
if pwm_w1 > pwm_tmp then
w1:=0
else
w1:=1;
end;
Procedure cfg_();
begin
tccr0:= %00000001; //clk/1 mega8
tcnt0:=0;
toie0_bit:=1; //
sreg_i_bit:=1; //
w1_Direction:=1;
w1:=1;
end;
begin
{ Main program }
cfg_ ;
pwm_w1:=50;
while true do
begin
nop;
end;
end.