'{$STAMP BS2} '{$PBASIC 2.5} ' 2008 mlab.taik.fi/paja ' Experiencing with RCTIME command ' ---[ I/O Definitions ]--- pPot PIN 10 ' ---[ Variables ]--- wResult VAR WORD ' ---[ Initialization ]--- DEBUG CLS, "Photoresictor with RCTIME", CR ' ---[ Main Code ]--- Main: DO HIGH pPot ' charge capacitor... PAUSE 1 ' ...for 1 ms ' RCTIME Pin, State, Variable ' Pin: Pin number (0-15) ' State: Specifies the desired state to measure (0-1) ' Variable: the time measurement will be stored. (BS2: a unit = 2us) RCTIME pPot, 1, wResult ' measure RC discharge time DEBUG DEC wResult, CR ' display result PAUSE 500 LOOP END