EVENT and PWM example. By Lee Davison
[Back]
Introduction.
In this very basic example the SuprDupr is used to measure the width of +ve pulses on the counter 0 input.The code.
10 TIMERX PWM : REM set PWM measure mode 20 CNTR0 - : REM -ve edge triggered, count when high 30 ON CNTR0 1000 : REM event code 40 TIMERX START : REM ensure timer can run 100 DO 110 DO : LOOP UNTIL EVENT : REM wait for event 120 PRINT TX : REM print result 130 LOOP : REM loop forever 1000 TX = TIMERX : REM read PWM value 1010 RETURN