Searching \ for 'R: Re: PULSE MEASURING' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/index.htm?key=pulse+measuring
Search entire site for: 'R: Re: PULSE MEASURING'.

Truncated match.
PICList Thread
'R: Re: PULSE MEASURING'
1998\04\02@185359 by Dr. Leonardo De Palo

flavicon
face
Hi All,
I am novice in this list.
I have beginned to study and try to use a PIC 16C84 four weeks ago.
As a case study i would build a RPM LED indicator for a two time engine for
the moto (Aprilia).

The problem is similar  as your 1 -2 millisecond measuring.

The engine i wont monitor , if running at 8.000 RPM have a period of 7.5
millisecon.

My approach is to use a 4Mhz quartz as main oscillator, then setting the
prescaler to divide by 256, and chekinh the FF-zero overflow you can reach
it every 0.032 millisecond.


Setting on RB0 the measuring signal, and set up the interrupt at level
change, you can count how many overflow there are between the interrupts.

Hi

Leonardo De Palo    spam_OUTleo.depaloTakeThisOuTspamtelesys.it

-----Messaggio originale-----
Da: ken <.....kenKILLspamspam@spam@WELWYN.DEMON.CO.UK>
A: PICLISTspamKILLspamMITVMA.MIT.EDU <.....PICLISTKILLspamspam.....MITVMA.MIT.EDU>
Data: giovedl 2 aprile 1998 21.34
Oggetto: Re: PULSE MEASURING


>In article <EraseME01BC3E08.F3687160spam_OUTspamTakeThisOuTdup4-wvb.iafrica.com.na>, Alastair
><bizzybspamspam_OUTIAFRICA.COM.NA> writes
>>Hi All
>>It looks as if the list is always divided into three types of users: those
who
>>do know, those who don't and those who don't care!
>>Anyway as one who doesn't know I'd like any help you've got to give,
please.
>>I need to measure the width of a pulse which occurs at about 30Hz with a
>>16c(f)84, the pulse width is variable between 1ms and 2ms and I need as
high a
>>resolution as possible(about 7bit should do) on the 1ms difference between
the
{Quote hidden}

1998\04\02@201818 by TONY NIXON 54964

flavicon
picon face
Leonardo, try this for your RPM counter. It should be accurate enough
for your purposes.

Use a PIC running at 8MHz and set up an  Interrupt, it for a duration of 100uS.
A 16F84 - 10P will be ok for this project with some external drivers for
a multiplexed display. Use the circuit I sent you to let the PIC detect the
ignition pulses from the coil.

100uS loop time
8MHz clock = 2MHz
cycle time  = 1/2MHz  =  500nS
100uS/500nS  =  200
prescaler set to divide by 4
preset tmr0  = 206
when = 0  =  100uS

Increment a COUNTER on each 100uS loop. This will need to be a two
byte counter.

Each time the points open (or close) save the count data in RAM. Then
reset the counter.

A loop outside the interrupt can be set, to say 0.5 seconds, to get the
RPM data for the display. Use this formula to calculate the current RPM.

124F80h  divided by  (Cylinders  X  Loops)

A 16 bit multiply routine for Cyls X Loops, and a 24 bit routine to
divide 124F80h by the result works well.

You will have to change the binary result into BCD then to a 7 segment
format to drive the multiplexed LED displays. Store the result into 4
RAM registers for the display update routines to use.

Using multiplexed displays will require a third timing loop to
control. All this is going to be tricky for a beginner.

When the RPM value gets too low, the Loop counter may overflow. You
will have to decide on a maximum value to allow this counter to get to
and then stop it incrementing. At 30 RPM for a single cylinder engine
the count will be 40,000 (9C40h).

Debounce the points input for 8 loops. This works well for an average
engine.

Take care with the power supply for your cct. The automotive
environment is not too friendly. Don't use the PIC with copper cored
spark plug leads or you will have problems. Use suppressed ones.

The above should read reasonably well to around 7500 RPM for a V8
which is not too bad. My old Henry the 8 will have a heart attack at
this RPM:-)

You may also need to average the RPM readings or just display '0' on
the units and/or tens digit to avoid jitter.

IRQ Loop

Ignore points change when debounce counter active.
Update 100uS Loop counter.
Update main loop counter
Update counters for display refresh.
Refresh display from display RAM when ready
Update Debounce counter


Main Loop

Wait until IRQ has set a timing value to update the RPM display
Calculate and convert RPM data for display data
Update display RAM

Hope this helps

Regards

Tony



PicNPoke Multimedia 16F84 Beginners PIC Tools.

**PLUS** - PicNPlay - PicNPlan - PicNPrep - PicNPost
PicNPort - DT Type Saver - *new* PicNQuiz.
Recent addition - DogBoneZ Component.

http://www.dontronics.com/picnpoke.html

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...