
Originally Posted by
Ioannis
Why not put it in one check and save a cycle?
Like this (untested):
Ioannis
or simpler to write ( may be same execution time ... )
Code:
Main:
While 1
Pulsin Porta.0, 1, Width 'Wait for a high pulse store the pulse width in the variable "Width."
if (Width >= 925 ) and ( Width <= 975) then high porta.1 '1900µs is on state. 1900µs /2 = 950
if (Width >= 475 ) and ( Width <= 525) then low porta.1 '1000µs is off state. 1000µs /2 = 500
'If channel 3 is indeed in the off state turn the LED off.
Wend
Alain
Bookmarks