Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Accuracy with wide range Capture with CCP

Status
Not open for further replies.

ankit44444

Newbie level 3
Joined
Sep 19, 2013
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
27
I am using the Capture from the CCP module of 16f877A to generate the RPM meter for the engine. The crankshaft has the teeth 28 or 32. Generally one of which is missing(so we get the pulse with double width) which marks the origin or reference, the rotation and hence the rpm.

I need to count 600rpm to 7000rpm, because the range is quite large I am not able to get the accurate result. Even with the steady input, the output keeps changing in a range of 10-20uS because of which the result is not accurate. Can anyone suggest how to achieve high accuracy while using the Capture module?
 

hello,

The crankshaft has the teeth 28 or 32

I didn't unsdertand what does it means?
sorry i'm french.
Is there 28 pulses per tour ? or 32 pulse per tour ?
Are all the teeh with same dimensions ?

What is the frequency input at 7000 rpm
7000*32/60=> 3733,33 Hz ?
What is your FOSC for 16F877A ?
why are you not using frequency measurement ?
edge counting on timer...
 

Hi,

Basically its a continuous square wave(converted from the original sine wave using ADC) with 31(or 27) pulses of same duty cycle(say x) and 1 pulse with double of that(i.e. 2x). These 31(or 27) + 1 pulses make one revolution. Depending on the type of engine, it can have 28/32/36 pulses in a revolution. Currently I am calculating the time between two double sized pulse's rising edge, which gives me the time for one revolution and accordingly the rpm.

Can you explain in more detail as to how can I use frequency measurement/edge counting in the scenario where the system can adapt to any number of pulses/revolution? I am using 20MHz external oscillator.
 

hello

The main probleme for counting RPM via Tooth width is accuracy..
and limit of max frequency by CCP technique...
but , correct me if i am wrong
max frequency will be 70000*36/60 gives 3733,3Hz, so not so high!

so you can measure the frequency in Hz, Nb pulses per second
and then multiply by 60 and divide by Number of theeths.

i wrote a test program in MikroC but with evaluate versus limited to 2K , so not so elaborate.
**broken link removed**
and another with a PIC18F252 and MPLAB C18 ...using CCP
**broken link removed**

in final,i am using a frequencmeter with a 16F84 but written 100% asm
to get the frequency measure .. because i want a very large scale of measurement 1Hz 40Mhz.. and UP to 433Mhz

i didn't check it, but it seems we can accumulate up to 16 edge counting with CCP methode
maybe with more evoluate PIC as 18F26K22
dont'forget to survey timer overflow !
 
hello,


I did some test with my DDS generator at different frequency
with CCP1 and constant square TTL signal on RC2 input ,
software uses 4 rising edges and base on 32 teeth.
If you want to adapt to other module of Teeh
it's easy for example to use 2 switches =2 inputs of PIC to choose witch module of teeth you want
so you can have 4 choices.
Calculation can follow this choice to show RPM value.

i get this results
4000Hz is large enough to cover your maxi speed
250Hz could be a problem

i try to handle timer1 overflow , but if i add some treatment inside interrupt , i get unstability of measure.
so i tread only one overflow, so range cover 250Hz to 4000Hz.
if you are interessted , i can post my C18 code, test on a 18F26K22 at 16Mhz (internal OSC)
at 4000Hz you get 8 measures per second ..one measure is an average of 100 raw measures.
at 250Hz it's need 2 secondes to take the average of 100 measures..

at 4000Hz <- 8 mesures within second
F= 4007.0 ; Rpm= 7513.1
F= 4006.6 ; Rpm= 7512.3
F= 4007.5 ; Rpm= 7514.1
F= 4007.3 ; Rpm= 7513.7
F= 4007.0 ; Rpm= 7513.1
F= 4006.9 ; Rpm= 7513.0
F= 4007.2 ; Rpm= 7513.5
F= 4006.4 ; Rpm= 7512.0
F= 4006.7 ; Rpm= 7512.5
F= 4006.7 ; Rpm= 7512.6
F= 4006.9 ; Rpm= 7512.8
F= 4007.4 ; Rpm= 7513.9
F= 4007.4 ; Rpm= 7513.9

and minima of frequency is 250Hz
at 250Hz <- Minima Freq 2sec for 1 mesure (accumulated 100 times)
F= 250.4 ; Rpm= 469.5
F= 250.4 ; Rpm= 469.5
F= 250.4 ; Rpm= 469.5
F= 250.4 ; Rpm= 469.5
F= 250.4 ; Rpm= 469.5
F= 250.4 ; Rpm= 469.4
F= 250.4 ; Rpm= 469.4
F= 250.4 ; Rpm= 469.5
F= 250.4 ; Rpm= 469.5
F= 250.4 ; Rpm= 469.5
 

Thanks for the elaborate explanation and multiple options.

The main probleme for counting RPM via Tooth width is accuracy..

so you can measure the frequency in Hz, Nb pulses per second
and then multiply by 60 and divide by Number of theeths..

I believe this is the answer to my question. Since counting individual pulse or a revolution gives high inaccuracy, finding the frequency over a 1/4 or 1/2 second period will give relatively low inaccuracy.

I will implement this and get back once I have my results.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top