Up one EVENT and PWM example. by Lee Davison Up to top

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

Last page update: 9th July, 2003. e-mail me e-mail