hi everyone,
I'm trying to calculate the width of a pulse that is an input to-let's say- RB0 pin of the PIC16F877A (portB configured as input).
I used the following algorithm:
trisb = 1
trisc = 0
dim counter as byte
a1:
IF RB0 = 0 then
goto a1
endif
while RB0 = 1
counter = counter +1
Wend
end
But the problem is that everytime I start the program, a different value of 'counter' is obtained.What gives??
thx in advance
I'm trying to calculate the width of a pulse that is an input to-let's say- RB0 pin of the PIC16F877A (portB configured as input).
I used the following algorithm:
trisb = 1
trisc = 0
dim counter as byte
a1:
IF RB0 = 0 then
goto a1
endif
while RB0 = 1
counter = counter +1
Wend
end
But the problem is that everytime I start the program, a different value of 'counter' is obtained.What gives??
thx in advance