code needs much longer then expected
hi all
on a 12f675 with internal osc speed 4mhz i have the following main routine. this toggles two digital outputs asyncronus. i thinked (dangerous?) that one cycle of this while execution needs some us - each line1 us. but in fact it needs much longer, around 800 us... any ideas why and what can be done for speed up?
thanks a lot
Code:
while z < 60 ' 30 cycles : 60 toggles of x=out1
if x > 0 then ' as long as the half cycle is not at the end
x = x - 1 ' decrement
else ' when the half cycle is finish
x = an1 + base1 ' set the delay new with the old values
z = z + 1 ' inc loop counter
out1 = out1 ^ 1 ' toggle output
endif
if y > 0 then
y = y - 1
else
y = an2 + base2
out2 = out2 ^ 1
endif
wend
i know it's only microcontrolling, but i like it!
Bookmarks