PDA

View Full Version : Accurate milliseconds time measurements?



StoneColdFuzzy
- 8th February 2010, 14:48
Hello. I would like to be able to verify the performance of a fan by having a PIC take some measurements and sending it to a serial port.

Fan motor data, nominal
Voltage: +26VDC
Current: 0.32 Amps
Speed: 18,300 RPM
Fan Performance Sensor (FPS) Output: +5VDC, 50% duty cycle.

The input power requirement of the fan drive signal shall be +28VDC. The maximum rise time of the +28VDC fan drive shall be 10ms to reach 90% of the full +28VDC.

One of the tests will consist of measuring time delay, in milliseconds from 90% rise time of maximum +28VDC fan drive to the first rising edge of the pulsed FPS.

Now, I know how to measure the voltages, but I'm not certain how to approach the time measurement, if it can even be done. Can anyone point me in the right direction?

If I can figure out the above, the next challenge for me will be to figure out how to measure the steady state current and send that to a serial port as well.

~ Dave

rmteo
- 8th February 2010, 17:36
This maybe?

5.59. PULSIN

PULSIN Pin,State,Var

Measures pulse width on Pin. If State is zero, the width of a low pulse
is measured. If State is one, the width of a high pulse is measured.
The measured width is placed in Var. If the pulse edge never happens
or the width of the pulse is too great to measure, Var is set to zero. If an
8-bit variable is used, only the LSB of the 16-bit measurement is
returned.

Pin is automatically made an input. Pin may be a constant, 0 - 15, or a
variable that contains a number 0 - 15 (e.g. B0) or a pin name (e.g.
PORTA.0).

The resolution of PULSIN is dependent upon the oscillator frequency. If
a 4MHz oscillator is used, the pulse width is returned in 10us increments.
If a 20MHz oscillator is used, the pulse width will have a 2us resolution.
Defining an OSC value has no effect on PULSIN. The resolution always
changes with the actual oscillator speed.

PULSIN normally waits a maximum of 65535 counts before it determines
there is no pulse. If it is desired to wait fewer counts before it stops
looking for a pulse or the end of a pulse, a DEFINE can be added:

DEFINE PULSIN_MAX 1000

StoneColdFuzzy
- 8th February 2010, 18:54
Thank you for the insight!

~ Dave