I am building a transistor circuit to sense if a motor is on or not. The transistor is there as a simple amplifier so at very low PWM duty cycles (and thus very low voltage) the transistor can bump the signal up to a point where the picaxe can read a simple high or low. The circuit works fine, however I sorta forgot that PWM is really clicking on and off --just at a high rate of speed. Now, lets say the PWM signal is on a 50/50 duty cycle --when I check to see if the motor is running with my little transistor circuit, I have a 50/50 shot (when I check the input pin) of getting a high signal. I need to sorta "keep the pwm on" during the low parts of the cycle. I would think a simple cap would slowly dischage and keep my transistor high as long as the pwm signal keeps coming but I am unsure of the size of the cap or it's polarity. By the way, the incoming PWM signal is protected with diodes so there is no chance of the transistor circuit backfeeding my motor controller and keeping my motors on... I hope.
Here is the question:
Which way does the cap go and anyone got a guess on how big?

Wait --shoulda seen this one
It goes between the pwm input and ground --duh, sorry…
I could still use some thoughts on size, though.
Why not deal with that
Why not deal with that through software?
Software
That is just the thing, I need all the processing speed I can get here. The time it takes to write the data to the eeprom is quite a bit so I have to keep everything else down to a min. For instance, reading the PWM, if it was coming in clean, i.e. a solid high or low, I can use one command, one check, done. Checking a pwm signal coming in would require at least 2 checks, spaced apart and timed with the pwm frequency to see if it is on or not. Just seems I need a cap to keep the line high for a tiny fraction of a second while the pwm goes low.
Hey Chris, try this on for
Hey Chris, try this on for size:

R1 is to limit the NPN's base current, to reduce power consumption and stop the transistor from cooking =)
C1 and R2 form the timing part of the circuit, where the 'time constant' is t=C1*R2 - a longer time constant will hold the PICAXE input low for longer.
If the NPN's gain and collector current are decent, and R1 is only a few kΩ, then even a very low duty-cycle PWM at the input will make the NPN drain all the voltage off C1, bringing the PICAXE input low. During the low part of the PWM cycle, R2 will attempt to recharge C1 and bring the input high again. I'd go with a small capacitor (0.1μF or something) and a fairly large resistor (~10kΩ) to set your hold time. If you find that at low duty cycles your PICAXE input is still going high too early, make R2 bigger to increase the hold time.
LM555 timer
Hey Chris
You could also use a LM555 timer that gets triggered by the PWM. Use the digital output of the timer in an input microprocessor.
The timer time only needs to be a little bit longer than our output PWM frequency.
As far as I remember the LM555 restarts it time each time the trigger input goes low meaning that continuos PWM will keep the LM555 output high regardles of the duty cycle.
This is an idea I just had.

This is an idea I just had. The PWM pulses will charge the C1. R3 will discharge it when there are no more pulse. The signal to the input will be low when there are pulses.
This is not testet though. I still like the LM555 timer version better.
I don’t know if this would
I don’t know if this would work, but can’t you use the PICAXE ’count’ function;
COUNT pwmPin, 5,W1 (this would give you an answer in 2,5ms)
Then if W1 has any value (is true) then there are PWM going on.
And (I’m embarrass to mention this) you have obviously removed all ‘DEBUG’ statements from your code sins the debug command slows the execution time down extremely.