--- Simple input device by VR and Kondensor ---- Using VR for TimeScale&FullScale (RCdecade curcuit) P24 ---------------------- | | | | | | | | |--->VR Capacitor 10kohm 0.01uF | | 100ohm | | | GND GND \ Get VR-value by using RC-Decay VR=10kohm C=0.01uF \ ( -- n) n:0,1,2,3,4 : getVR h20000000 VR + ctra COG! \ Set "POS detector" mode 1 frqa COG! VR dup pinout pinhi \ Set VR-port to Output(Hi) 0 phsa COG! VR pinin \ Set VR-port to Input begin ina COG@ 1 VR lshift and 0= until phsa COG@ \ dup . dup d10000 > if drop 4 else dup d8500 > if drop 3 else dup d6500 > if drop 2 else d4600 > if 1 else 0 thens ; This measure discarge-time. Of course, that value depend on resistor and kondensor. You can select menu by getting value. But getting value vibrate near threshold value. I think this can prevent by using hysterisis. --- Long time duretion ---- : test h18000000 d10 + ctra COG! \ DUTY single-ended d10 pinout d53686 frqa COG! h68000000 d10 + ctrb COG! \ LOGIC A 1 frqb COG! d1000 negate phsb COG! cnt COG@ begin phsb COG@ 0> until cnt COG@ swap - d80000 u/ . ; CounterA output 1pulse 1msec by 1msec. CounterB receive CounterA's pulse. "begin -- until' take 1second because phsb set d-1000. If phsb set d-3600, time duration is 1hour.