>>I am using a 16C56 part to measure pulse widths >>(in the 0 to 10 ms range). My problem is that I >>am getting unreliable input pin detection within >>software. I am driving the pin with a test 50 percent >>duty square wave, and the measued pulse is correct most >>of the time, but on random occasions the software indicates >>that the pulse is slightly longer than it really is. >> >>I am driving the input pin via an 4N25 optocoupler, with >>the input pin connected between the collector of the phototransistor >>(with the emitter grounded) and a 4.7K pullup resistor. >>I believe the software is working correctly, and the problem is >>With the hardware implementation. >> >>Do I need any special filtering on input ports to reduce >>false triggering? Am is missing something?? >> >>- Bruce >> >> I just checked the 4N25 data sheets, (had to go to the office anyway). The motorola data sheets show that with RL=1K the turn off time has a minimum of ~10us around 3ma led current. but rises either side of that wheras with RL=100R the minumum off time is 4-5us at a led current of 7 ma or so. And only slightly faster with RL=10R. So I suggest that you first check the led current is around 7 ma and then change the pull up to 100R. Ray Gardiner, Shepparton, Victoria, Australia ray@dsp-systems.com Technical Director DSP Systems http://www.dsp-systems.com Private e-mail to:- ray@netspace.net.au