This work
if (RPM > 3) then
low Estarter
else
high Estarter
pause 100
endif
this no work
if (RPM <= 3) then
high Estarter
pause 100
low Estarter
endif
Printable View
This work
if (RPM > 3) then
low Estarter
else
high Estarter
pause 100
endif
this no work
if (RPM <= 3) then
high Estarter
pause 100
low Estarter
endif
Is rpm less than or equal to 3 when it doesn't work?
This work
if (RPM > 3) then
low Estarter
else
high Estarter
pause 100
endif
this no work
if (RPM <= 3) then (when is less the 3)
high Estarter
pause 100
low Estarter
endif
IF THEN with out an else has to have the THEN condition on the same line. This should work assuming "Estarter" is a Label or Statement.
Code:if (RPM <= 3) then high Estarter
pause 100
low Estarter
It should work fine as-is, but if you expect to see the LED blink, you would probably
want a short pause after each logic state change.
I.E.;
This definitely works. LED blinks 4 times on each pass through the loop.Code:RPM VAR BYTE
SYMBOL Estarter = PORTB.0
PORTB.0=0
TRISB.0=0
Main:
for RPM = 0 TO 255
if (RPM > 3) then
low Estarter
pause 100
else
high Estarter
pause 100
endif
if (RPM <= 3) then
high Estarter
pause 100
low Estarter
pause 100
endif
next RPM
goto Main
END